import os
import cgi
import string
import random
import urllib
import gdata.youtube
import gdata.youtube.service
from google.appengine.ext import db
from google.appengine.api import users
from google.appengine.api import urlfetch
from google.appengine.api import memcache
from google.appengine.ext import webapp
from google.appengine.api.labs import taskqueue
from google.appengine.ext.webapp.util import run_wsgi_app

#############################################################
#PAGE_HEADER_DESKTOP Generic HTML header for desktop browsers
#############################################################
PAGE_HEADER_DESKTOP = "<!DOCTYPE xhtml PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\
\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n\
<head>\n\
<meta name=\"google-site-verification\" content=\"Bye9bSuN86EkhG80d9U7HfaqJ6jmzY4LVnZ0jM87Jjc\" />\n\
<meta name=\"description\" content=\"DESCRIPTION_CONTENT\" />\n\
<meta name=\"keywords\" content=\"KEYWORDS_CONTENT\" />\n\
<meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\" />\n\
<meta http-equiv=\"Content-Style-Type\" content=\"text/css\" />\n\
<title>URL IS/IT</title>\n\
<link rel=\"icon\" type=\"image/x-ico href=img/f0.ico\" />\n\
<link rel=\"shortcut icon\" type=\"image/x-icon href=img/f0.ico\" />\n\
<!--\n\
###########################################\n\
#web design template by FreeDesignDepot.com\n\
###########################################\n\
-->\n"

###########################################################################
#PAGE_HEADER_MOBILE_LOW_END Generic HTML header for low-end mobile browsers
###########################################################################
PAGE_HEADER_MOBILE_LOW_END = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n\
<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\" \"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">\n\
<html xmlns=\"http://www.w3.org/1999/xhtml\">\n\
<head>\n\
<title>URL IS/IT</title>\n"

######################################################################
#STYLE_SHEET_DESKTOP HTML link to ccs style sheet for desktop browsers
######################################################################
STYLE_SHEET_DESKTOP = "\
<link rel=\"stylesheet\" type=\"text/css\" href=\"css/style.css\" />\n\
<!--[if lt IE 7]>\n\
 <link rel=\"stylesheet\" href=\"css/ie6.css\" />\n\
<![endif]-->\n\
</head>\n"

##########################################################################
#STYLE_SHEET_MOBILE_LOW_END inline style sheet for low-end mobile browsers
##########################################################################
STYLE_SHEET_MOBILE_LOW_END = "\
<style type=\"text/css\"> \n\
body#AA  { background-color: #2d2d2d; }\n\
.grey0   { background: #595959; color: white; border-bottom: solid 1px gold; margin: 0 0 5px 0; padding: 2px; }\n\
.grey1   { background: #595959; color: white; }\n\
.grey2   { background: #4f4f4f; color: white; }\n\
.grey3   { background: #434343; color: #a9a9a9; }\n\
.grey4   { background-color: #636363; }\n\
.grey5   { background-color: #737373; }\n\
.grey6   { background-color: #838383; }\n\
.grey7   { background-color: #939393; }\n\
.grey8   { background-color: #a3a3a3; }\n\
.grey9   { background-color: #b3b3b3; }\n\
.grey10  { background-color: #c3c3c3; }\n\
.grey11  { background-color: #191919; }\n\
.grey12  { background-color: #292929; }\n\
.grey13  { background-color: #393939; }\n\
.grey14  { background-color: #494949; }\n\
.grey15  { background-color: #696969; }\n\
.grey16  { background-color: #797979; }\n\
.grey17  { background-color: #898989; }\n\
.norm    { font-family: tahoma, arial; font-weight: normal; font-size: 10px; color: #d4d4d4; }\n\
.orb     { font-family: tahoma, arial; font-weight: normal; font-size: 10px; color: #ffc000; }\n\
.odd     { font-family: tahoma, arial; font-weight: bold;   font-size: 16px; color: #a9a9a9; }\n\
.url     { font-family: tahoma, arial; font-weight: bold;   font-size: 16px; color: #ffffff; }\n\
.g       { font-weight: bold; font-size: 18px; color: blue;    }\n\
.e       { font-weight: bold; font-size: 18px; color: red;     }\n\
.o       { font-weight: bold; font-size: 18px; color: #ffc000; }\n\
.l       { font-weight: bold; font-size: 18px; color: lime;    }\n\
.txtar   { border: #3a3a3a 1px solid; width: 110px; height: 110px; font-family: tahoma, arial, verdana;\
           overflow: auto; background-color: #232323; font-size: 10px; color: #5f5f5f;}\n\
.inputc  { border: #3a3a3a 1px solid; width: 110px; height: 20px; font-family: tahoma, arial, verdana; \
           background-color: #232323; font-size: 11px; color: #5f5f5f;}\n\
.footer  { background: #2d2d2d; color: gold; border-top: solid 1px gold; margin: 10px 0 0 0; }\n\
.company { font-weight: bold; }\n\
.ibm     { font-family: arial, tahoma; font-weight: bold; }\n\
.bmm     { font-family: tahoma, arial; cursor: pointer; background-color: #222222;\n\
           color: #a9a9a9; font-weight: bold; height: 18px; width: 110px; font-size: 10px; }\n\
.but1    { background-position: center; background-repeat: no-repeat; cursor: pointer; border: 0px solid; width: 44px; height: 11px; margin: 0px 30px 0px 0px;}\n\
.but2 { background-position: center; background-repeat: no-repeat; cursor: pointer; border: 0px solid; width: 47px; height: 11px; margin: 0px 2px 0px 0px;}\n\
.link    { font-family: tahoma, arial; font-weight: normal; font-size: 10px; color: #ffc000; text-decoration: underline; }\n\
hr       { clear: both; border:solid; border-width:1px; border-bottom-color:#007300;\n\
           border-top-color:#ffffff; border-left-color:#ffffff; border-right-color:#ffffff;}\n\
h1       { font-family: tahoma, arial; font-weight: bold; color: #ffc000; }\n\
.top-news img { float: left; margin-right: 5px; }\n\
.top-news h3, .news h3 { font-size: large; font-weight: bold; }\n\
.accesskey { text-decoration: underline; }\n\
a { text-decoration: none; }\n\
.validation { margin-top: 10px; }\n\
.product img { float: left; margin-right: 5px; }\n\
.product h3, .news h3 { font-size: large; font-weight: bold; }\n\
</style>\n\
</head>\n"

###########################################################
#JAVASCRIPT_LIB html links to external JavaScript libraries
###########################################################
JAVASCRIPT_LIB = "\
<script type=\"text/javascript\" src=\"http://www.google.com/jsapi\"></script>\n\
<script type=\"text/javascript\">google.load(\"swfoject\", \"2.1\");</script>\n"

######################################################################
#JQUERY_READY jQuery document on ready function for pages using jQuery
######################################################################
JQUERY_READY = "\
<script type=text/javascript>\n\
$(document).ready(function() {\n\
 $(\"#orderedlist\").addClass(\"red\");\n\
 });\n\
});\n\
</script>\n"

############################################################
#MAIN_MENU_DESKTOP main menu common across all desktop pages
############################################################
MAIN_MENU_DESKTOP = "<body id=\"AA\">\
<table id=\"AB\" width=684px cellpadding=0 cellspacing=0 border=0>\
<tr valign=bottom><td><img id=\"AC\" src=img/AC.gif width=684 height=212 alt=\"URL IS/IT\" /></td></tr>\
<tr valign=top><td><button class=but6 onClick=\"window.location=\'About\'\" onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#a9a9a9\'\">About Us</button><button class=but6 onClick=\"window.location=\'Services\'\" onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#a9a9a9\'\">Services</button><button class=but6 onClick=\"window.location=\'Solutions\'\" onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#a9a9a9\'\">Solutions</button><button class=but6 onClick=\"window.location=\'Support\'\" onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#a9a9a9\'\">Support</button><button class=but6 onClick=\"window.location=\'Products\'\" onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#a9a9a9\'\">Products</button><button class=but6 onClick=\"window.location=\'Contact\'\" onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#a9a9a9\'\">Contact Us</button></td></tr><tr valign=top><td>\n"

###########################################################################
#MAIN_MENU_MOBIL_LOW_END main menu common across all low-end mobile devices
###########################################################################
MAIN_MENU_MOBILE_LOW_END = "<body id=\"AA\"><h1>URL IS/IT</h1><br />\
<a class=link href=About    >About Us</a>  \
<a class=link href=Services >Services</a>  \
<a class=link href=Solutions>Solutions</a> \
<a class=link href=Support  >Support</a>   \
<a class=link href=Products >Products</a>  \
<a class=link href=Contact  >Contact Us</a><br />\n"

#####################################################
#PAGE_FOOTER_DESKTOP html footer for desktop browsers
#####################################################
PAGE_FOOTER_DESKTOP = "</td></tr>\
<tr><td align=center class=\"copy bgcopy\" height=64><font class=orb><a href=home class=link>Home</a></font></td></tr>\
<tr><td align=center height=18 class=web>&copy; 2007 Todd Url</td></tr></table>\n\
<script type=\"text/javascript\">\n\
var gaJsHost = ((\"https:\" == document.location.protocol) ? \"https://ssl.\" : \"http://www.\");\n\
document.write(unescape(\"%3Cscript src='\" + gaJsHost + \"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E\"));\n\
</script>\n\
<script type=\"text/javascript\">\n\
try {\n\
var pageTracker = _gat._getTracker(\"UA-11366362-1\");\n\
pageTracker._trackPageview();\n\
} catch(err) {}\n\
</script>\n\
</body>\n\
</html>"

##################################################################
#PAGE_FOOTER_MOBILE_LOW_END html footer for low-end mobile devices
##################################################################
PAGE_FOOTER_MOBILE_LOW_END = "\
<div class=mstd>\
<font class=orb>\
<a href=home class=link>\
Home\
</a>\
</font>\
</div>\
<font class=norm>\
&copy 2007 Todd Url\
</font>\
</body>\
</html>"

######################################################
#Feed names and local codes for YouTube standard feeds
######################################################
localname      = ['USA','Australia','Brazil','Canada','Czech','France','Germany','Britain','Holland','HongKong','India',\
                 'Ireland','Israel','Italy','Japan','Mexico','NZealand','Poland','Russia','S Korea','Spain','Sweden','Taiwan']
localcode      = ['US','AU','BR','CA','CZ','FR','DE','GB','NL','HK','IN','IE','IL','IT','JP','MX','NZ','PL','RU','KR',\
                 'ES','SE','TW']
feedname       = ['Top Rated','Top Favorites','Most Viewed','Most Popular','Most Recent','Most Discussed',\
                 'Most Responded','Recently Featured']
feedid         = ['top_rated','top_favorites','most_viewed','most_popular','most_recent','most_discussed',\
                 'most_responded','recently_featured']

###########################################################################
#Datastore model for web contacts database, loaded via form in Contact page
###########################################################################
class Contact_Form(db.Model):
  REF 		= db.TimeProperty(auto_now_add=True)
  First_Name 	= db.StringProperty() 
  Last_Name 	= db.StringProperty() 
  Email_Address = db.StringProperty() 
  Telephone 	= db.StringProperty() 
  Message 	= db.StringProperty(multiline=True) 

#########################################################################
#Datastore model for managing the state of URLeScopes vieweing URLeVision
#########################################################################
class URLeScope(db.Model):
  time		= db.TimeProperty(auto_now_add=True)
  uvPWR         = db.StringProperty()
  uvViewing     = db.StringProperty()
  dispInfo      = db.StringProperty()
  currChannel   = db.IntegerProperty()
  prevChannel   = db.IntegerProperty()
  favChannel    = db.IntegerProperty()
  progScope     = db.IntegerProperty()
  uv0           = db.StringListProperty()
  uv0seq        = db.IntegerProperty()
  uv0name       = db.StringProperty()
  uv0desc       = db.StringProperty()
  uv0info       = db.StringListProperty()
  uv1           = db.StringListProperty()
  uv1seq        = db.IntegerProperty()
  uv1name       = db.StringProperty()
  uv1desc       = db.StringProperty()
  uv1info       = db.StringListProperty()
  uv2           = db.StringListProperty()
  uv2seq        = db.IntegerProperty()
  uv2name       = db.StringProperty()
  uv2desc       = db.StringProperty()
  uv2info       = db.StringListProperty()
  uv3           = db.StringListProperty()
  uv3seq        = db.IntegerProperty()
  uv3name       = db.StringProperty()
  uv3desc       = db.StringProperty()
  uv3info       = db.StringListProperty()
  uv4           = db.StringListProperty()
  uv4seq        = db.IntegerProperty()
  uv4name       = db.StringProperty()
  uv4desc       = db.StringProperty()
  uv4info       = db.StringListProperty()
  uv5           = db.StringListProperty()
  uv5seq        = db.IntegerProperty()
  uv5name       = db.StringProperty()
  uv5desc       = db.StringProperty()
  uv5info       = db.StringListProperty()
  uv6           = db.StringListProperty()
  uv6seq        = db.IntegerProperty()
  uv6name       = db.StringProperty()
  uv6desc       = db.StringProperty()
  uv6info       = db.StringListProperty()
  uv7           = db.StringListProperty()
  uv7seq        = db.IntegerProperty()
  uv7name       = db.StringProperty()
  uv7desc       = db.StringProperty()
  uv7info       = db.StringListProperty()
  uv8           = db.StringListProperty()
  uv8seq        = db.IntegerProperty()
  uv8name       = db.StringProperty()
  uv8desc       = db.StringProperty()
  uv8info       = db.StringListProperty()
  uv9           = db.StringListProperty()
  uv9seq        = db.IntegerProperty()
  uv9name       = db.StringProperty()
  uv9desc       = db.StringProperty()
  uv9info       = db.StringListProperty()

####################################################################################################
#Datastore model for managing the state of URLeVision viewers. Provides persisent backup to memcache
####################################################################################################
class uv_viewer(db.Model):
  time		= db.TimeProperty(auto_now_add=True)
  vid     	= db.StringProperty() 
  ref    	= db.StringProperty() 
  pwr           = db.StringProperty()
  viewing       = db.StringProperty()
  currChannel   = db.IntegerProperty()
  prevChannel   = db.IntegerProperty()
  favChannel    = db.IntegerProperty()
  chname        = db.StringProperty()
  chid          = db.StringProperty()
  src           = db.IntegerProperty()
  srcname       = db.StringProperty()
  srccode       = db.StringProperty()
  uv0seq        = db.IntegerProperty()
  uv1seq        = db.IntegerProperty()
  uv2seq        = db.IntegerProperty()
  uv3seq        = db.IntegerProperty()
  uv4seq        = db.IntegerProperty()
  uv5seq        = db.IntegerProperty()
  uv6seq        = db.IntegerProperty()
  uv7seq        = db.IntegerProperty()
  uv8seq        = db.IntegerProperty()
  uv9seq        = db.IntegerProperty()

##########################################################################
#detectDevice provides device detection for all browsers including mobiles
##########################################################################
def detectDevice():
  global DEVICE
  if os.environ.has_key("HTTP_X_WAP_PROFILE"):
    DEVICE = "MOBILE_LOW_END"
    HTTP_X_WAP_PROFILE = os.environ["HTTP_X_WAP_PROFILE"]
    return
  else:
    HTTP_USER_AGENT = os.environ["HTTP_USER_AGENT"]
    if HTTP_USER_AGENT.find("Nokia") is not -1:
      DEVICE = "MOBILE_LOW_END"
      return
    else:
      DEVICE = "DESKTOP"
      return

########################################
#About page, provides home page for site
########################################
class about(webapp.RequestHandler):
  def get(self):
    global PAGE_HEADER_DESKTOP
    PAGE_HEADER_DESKTOP = PAGE_HEADER_DESKTOP.replace("URL IS/IT", "URL IS/IT - Google&#153 Technology Specialists")
    PAGE_HEADER_DESKTOP = PAGE_HEADER_DESKTOP.replace("DESCRIPTION_CONTENT", "URL IS/IT provides professional services to companies deploying the ever expanding portfolio Google information technologies.")
    #####################################################
    #about PAGE_DESKTOP Generic page for DESKTOP browsers
    #####################################################
    PAGE_DESKTOP = "\
    <table width=684 border=0 cellpadding=0 cellspacing=0 summary=content>\
    <tr valign=top>\
    <td rowspan=2 class=\"grey2 greyj\" width=342>\
    <div class=mhead>\
    <img id=\"AD\" src=img/AD.png width=300 height=31 alt=\"Google IT Specialists\" />\
    </div>\
    <div class=mstd>\
    <font class=orb>\
    URL IS/IT provides professional services to companies deploying the ever expanding \
    portfolio Google&#153 information technologies.\
    </font>\
    Our consulting engineers have an excellent understanding of the Google&#153 \
    technologies and APIs which form the foundation of Google Apps&#153 based \
    solutions as well as extensive industry experience in all phases of the software \
    development life cycle. We focus on the technical aspects of the challenges \
    your team faces so you're free to concentrate on what's really important, your \
    business.  Our specialties include:\
    </div>\
    <img id=\"AH\" src=img/YouTube.png width=125 height=125 alt=\"Google APIs\" />\
    <div class=lfltlft>\
    <ul class=ul>\
    <li class=li2><a href=URLeScope class=link>YouTube Data API</a></li>\
    <li class=li2><a href=NEWRLeScope class=link>OpenID/OAuth SSO</a></li>\
    <li class=li2>Lotus Notes Migration</li>\
    <li class=li2>Secure Data Connector</li>\
    <li class=li2>Datastore Development</li>\
    </ul>\
    </div>\
    <div class=mstd>\
    The list of solutions continues to grow and so does our expertise with the various \
    APIs including those available via the Google Web Toolkit. The following short \
    list of demonstrations illustrate some of the possibilities available via the Google APIs.\
    </div>\
    </td>\
    <td class=\"grey1 greyj\" width=342>\
    <div class=mhead>\
    <img id=\"AE\" src=img/AE.gif width=300 height=31 alt=\"IBM Experience\" />\
    </div>\
    <div class=mstd>\
    <font class=orb>\
    URL IS/IT has a decade of experience developing and deploying large scale systems \
    for IBM Global Services&#153. \
    </font>\
    The technical staff at URL IS/IT has extensive knowledge of IBM and Lotus \
    Software (Notes, Domino, SameTime, SmartSuite, DB2, WebSphere, MQSeries, \
    Message Broker, Tivoli, and Content Manager), as well as the tools employed \
    to test enterprise class solutions such as WinRunner and LoadRunner. For details \
    see our <a href=Experience class=link>list of past engagements.</a>\
    </div>\
    </td>\
    </tr>\
    <tr>\
    <td valign=top class=\"grey3 greyj\">\
    <div class=mhead>\
    <img id=\"AF\" src=img/AF.jpg width=300 height=31 alt=\"Android Ready\" />\
    </div>\
    <div class=mstda>\
    <font class=orb>\
    Need a software quality assurance professional on your Android development team? \
    </font>\
    We are constantly gaining experience on the Android platform as we develop our\
    </div>\
    <img id=\"AG\" src=img/AG.jpg width=135 height=90 alt=\"Powered by Android\" />\
    <div class=rfltlft>\
    own applications. We currently provide professional services for development \
    efforts in need of software quality assurance expertise.  Our focus has been on \
    test case development, documentation \
    </div>\
    <div class=mstdb>\
    and automation using jUnit, the debugger and Android instrumentation under eclipse.\
    </div>\
    </td>\
    </tr>\
    </table>"
    ##################################################################
    #about PAGE_MOBILE_LOW_END Generic page for low-end mobile devices
    ##################################################################
    PAGE_MOBILE_LOW_END = "<div class=grey2>\
    <font class=g>G</font><font class=e>o</font><font class=o>o</font><font class=g>g</font><font class=l>l</font><font class=e>e</font>\
    <font class=url> IT Specialists</font>\
    </div>\
    <div class=grey2>\
    <font class=orb>\
    URL IS/IT provides professional services to companies deploying the ever\
    expanding portfolio Google information technologies.\
    </font>\
    <font class=norm>\n\
    Our consulting engineers have an excellent understanding of the Google \
    technologies and APIs which form the foundation of Google Apps based solutions \
    as well as extensive industry experience in all phases of the software \
    development life cycle.  We focus on the technical aspects of the challenges \
    your team faces so you're free to concentrate on what's really important, your \
    business.  Our specialties include:<br />\n\
    <a class=link href=YouTube_Data_API>YouTube Data API</a><br />\
    <a class=link href=#>OpenID/OAuth SSO</a>               <br />\
    <a class=link href=#>Lotus Notes Migration</a>          <br />\
    <a class=link href=#>Secure Data Connector</a>          <br />\
    <a class=link href=#>Datastore Development</a>          <br />\
    The list of solutions continues to grow and so does our expertise with the \
    various APIs including those available via the Google Web Toolkit. The following \
    list of demonstrations illustrate some of the possibilities available via the \
    Google APIs.\
    </font>\
    </div>\
    <div class=grey1>\
    <font class=odd>IBM</font><font class=url> Experience</font>\
    </div>\
    <div class=grey1>\
    <font class=orb>\
    URL IS/IT has a decade of experience developing and deploying large scale systems \
    for IBM Global Services. \
    </font>\
    <font class=norm>\
    The technical staff at URL IS/IT has extensive knowledge of IBM and Lotus \
    Software (Notes, Domino, SameTime, SmartSuite, DB2, WebSphere, MQSeries, \
    Message Broker, Tivoli, and Content Manager), as well as the tools employed \
    to test enterprise class solutions such as WinRunner and LoadRunner. \
    For details see our <a href=Experience class=link>list of past engagements.</a>\
    </font>\n\
    </div>\n\
    <div class=grey3>\n\n\
    <font class=odd>Android</font><font class=url> Ready</font>\
    </div>\
    <div class=grey3>\
    <font class=orb>\
    Need a software quality assurance professional on your Android development team? \
    </font>\
    <font class=norm>\
    We are constantly gaining experience on the Android platform as we develop our\
    own applications.\
    </div>\
    <div class=grey3>\
    We currently provide professional services for development efforts in need of \
    software quality assurance expertise.  Our focus has been on test case \
    development, documentation and automation using jUnit, the debugger and \
    Android instrumentation under eclipse.\
    </div>"
    global DEVICE
    detectDevice()
    if DEVICE == "DESKTOP":
      self.response.out.write(PAGE_HEADER_DESKTOP)
      self.response.out.write(STYLE_SHEET_DESKTOP)
      self.response.out.write(MAIN_MENU_DESKTOP)
      self.response.out.write(PAGE_DESKTOP)
      self.response.out.write(PAGE_FOOTER_DESKTOP)
    if DEVICE == "MOBILE_LOW_END":
      self.response.out.write(PAGE_HEADER_MOBILE_LOW_END)
      self.response.out.write(STYLE_SHEET_MOBILE_LOW_END)
      self.response.out.write(MAIN_MENU_MOBILE_LOW_END)
      self.response.out.write(PAGE_MOBILE_LOW_END)
      self.response.out.write(PAGE_FOOTER_MOBILE_LOW_END)

########################################################
#Experience PAGE basically displays Resume' for Todd Url
########################################################
class experience(webapp.RequestHandler):
  def get(self):
    global PAGE_HEADER_DESKTOP
    PAGE_HEADER_DESKTOP = PAGE_HEADER_DESKTOP.replace("URL IS/IT", "URL IS/IT - Experience")
    ##########################################################
    #experience PAGE_DESKTOP Generic page for DESKTOP browsers
    ##########################################################
    PAGE_DESKTOP = "\
    <table width=684 border=0 cellpadding=0 cellspacing=0 summary=content>\
    <tr valign=top>\
    <td class=\"grey2 greyj\" width=170>\
    <div class=msig>\
    <font class=odd>Todd</font> <font class=url>Url</font></font>\
    </div>\
    </td>\
    <td class=\"grey3 greyj\" width=342>\
    <div class=msig>\
    </font><font class=odd>Founder and Chief Engineer of </font><font class=url>URL IS/IT</font>\
    </div>\
    </td>\
    </tr>\
    <td class=\"grey2 greyj\" width=170 valign=top>\
    <div class=mqig>\
    <font class=orb>Summary</font><br />\
    </div>\
    </td>\
    <td class=\"grey1 greyj\" width=342>\
    <div class=muig>\
    <font class=orb>Information System Architect experienced in all phases of software and hardware development lifecycles.</font> \
    Designed and executed performance and stress tests against global applications. Wrote and executed system and integration tests \
    for large scale B2B projects. Identified requirements and reported coverage to client and IBM executives. Managed defects, issues \
    and resolutions. Performed benchmarking and performance analysis of integrated information systems. Developed specialized tools to \
    meet customer and application specific needs. Helped turn around problem projects. Strong strategic thinker with a can do attitude.\
    </div>\
    </td>\
    </tr>\
    <td class=\"grey2 greyj\" width=170 valign=top>\
    <div class=mqig>\
    <font class=orb>Areas of Expertise</font><br />\
    </div>\
    </td>\
    <td class=\"grey4 greyj\" width=342 valign=top>\
    <div class=muig>\
    <ul class=ul2>\
    <li class=li2><font class=orb>S</font>ervice <font class=orb>O</font>riented <font class=orb>A</font>rhitecture design, implementation \
    and verification</li>\
    <li class=li2>System performance profiling, monitoring, stress testing and analysis</li>\
    <li class=li2>High availability, system fail-over and recovery verification</li>\
    <li class=li2>Network systems hardware, software, protocols and APIs</li>\
    <li class=li2>Database design, administration and performance tuning</li>\
    <li class=li2>Lotus Notes design, development and deployment</li>\
    <li class=li2>Unit, system and integration testing</li>\
    <li class=li2>Systems analysis and synthesis</li>\
    <li class=li2>Software tool development</li>\
    <li class=li2>Technical Marketing</li>\
    <li class=li2>Technical Sales</li>\
    <li class=li2>Programming</li>\
    </ul>\
    </div>\
    </td>\
    </tr>\
    <td class=\"grey2 greyj\" width=170 valign=top>\
    <div class=mqig>\
    <font class=orb>IBM Global Services&trade</font><br />\
    </div>\
    </td>\
    <td class=\"grey5 greyj\" width=342>\
    <div class=mvig>\
    <font class=orb>Philips Consumer Electronics</font> Developed system used to verify environment availability and readiness on demand \
    and executed Failover and Recovery Test of large scale SOA for key IBM account.\
    </div>\
    <div class=mtig>\
    <ul class=ul2>\
    <li class=li2>Wrote and executed SOA Environment Verification Test Plan and Final Report.</li>\
    <li class=li2>Wrote and executed SOA System Fail-over and Recovery Test Plan and Final Report.</li>\
    <li class=li2>Developed integrated web service which continuously monitors and reports SOA availability, performance and service \
    response time. Key personal are alerted via SMS upon failure of any infrastructure component, communication link or application \
    subsystem. Metric history is maintained in DB2 and HTML summary reports including availability and performance histograms are \
    delivered via SMTP.</li>\
    </ul>\
    </div>\
    </td>\
    </tr>\
    <td class=\"grey2 greyj\" width=170 valign=top>\
    <div class=mqig>\
    </div>\
    </td>\
    <td class=\"grey6 greyj\" width=342>\
    <div class=mvig>\
    <font class=orb>PartnerCommerce and PartnerCommerce/Servers</font> Executed end2end performance and stress testing against large scale B2B system. Wrote and maintained LoadRunner and WinRunner based test suites used to verify release readiness and response time history.\
    </div>\
    <div class=mtig>\
    <ul class=ul2>\
    <li class=li2>Verified performance characteristics of 4 major releases.</li>\
    <li class=li2>Measured system throughput and response time for all transactions.</li>\
    <li class=li2>Performed detailed analysis of page delivery and decomposition of response time components.</li>\
    <li class=li2>Measured system throughput and response time for all transactions.</li>\
    <li class=li2>Provided troubleshooting skills aided resolution of feature specific performance problems.</li>\
    <li class=li2>Measured transaction residence time at every component from Order Entry through TX Hub/InfoSource to SAP and back to order confirmation page.</li>\
    <li class=li2>Performed Application Profiling using Compuware Application Expert.</li>\
    </ul>\
    </div>\
    </td>\
    </tr>\
    <td class=\"grey2 greyj\" width=170 valign=top>\
    <div class=mqig>\
    </div>\
    </td>\
    <td class=\"grey4 greyj\" width=342>\
    <div class=mvig>\
    <font class=orb>PartnerInfo</font> Executed system, integration and performance test against world class Lotus Notes/Domino global information system.\
    </div>\
    <div class=mtig>\
    <ul class=ul2>\
    <li class=li2>Wrote system, integration and perfomance test plans, test cases, test scripts and test summary reports.</li>\
    <li class=li2>Designed and executed Global Notes Architecture replication benchmark.</li>\
    </ul>\
    </div>\
    </td>\
    </tr>\
    <td class=\"grey2 greyj\" width=170 valign=top>\
    <div class=mqig>\
    </div>\
    </td>\
    <td class=\"grey5 greyj\" width=342>\
    <div class=mvig>\
    <font class=greyj><font class=orb>Kodak Health Imaging Systems</font> Performed DB2 dataload analysis and resolved critical performance issues.\
    </div>\
    </td>\
    </tr>\
    <td class=\"grey2 greyj\" width=170 valign=top>\
    <div class=mqig>\
    </div>\
    </td>\
    <td class=\"grey6 greyj\" width=342>\
    <div class=mvig>\
    <font class=orb>Visa&trade Integreon Financial Systems</font> Performed System Test and aided customization and roll-out of \"turn-key\" CICS/COM/DCOM based web banking system for IBM reference accounts.\
    </div>\
    <div class=mtig>\
    <ul class=ul2>\
    <li class=li2>BankOne</li>\
    <li class=li2>Nations Bank</li>\
    </ul>\
    </div>\
    </td>\
    </tr>\
    <td class=\"grey2 greyj\" width=170 valign=top>\
    <div class=mqig>\
    <font class=orb>3Com</font><br />\
    </div>\
    </td>\
    <td class=\"grey4 greyj\" width=342>\
    <div class=mvig>\
    <font class=orb>Associate Architect, Corporate MIS.</font> Provided technical and project management support to lead Architect.\
    </div>\
    <div class=mvig>\
    <ul class=ul2>\
    <li class=li2>Assisted design and managed roll-out of multi-protocol global remote access facility.</li>\
    <li class=li2>Assisted design and managed roll-out of corporate <font class=orb>SONET OC3</font> backbone network.</li>\
    <li class=li2>Managed roll-out of global IP router backup, restore and software distribution system.</li>\
    </ul>\
    </div>\
    </td>\
    </tr>\
    <td class=\"grey2 greyj\" width=170 valign=top>\
    <div class=mqig>\
    </div>\
    </td>\
    <td class=\"grey5 greyj\" width=342>\
    <div class=mvig>\
    <font class=orb>Software Engineer, Network Systems Division.</font> Wrote test plans, test cases, test scripts and test summary reports.\
    </div>\
    <div class=mtig>\
    <ul class=ul2>\
    <li class=li2>Verified the <b>QOS</b> port queue metering algorithym of the 3Com NetBuilder multi-protocol router.</li>\
    <li class=li2>Automated test cases in <b>C</b> and <b>Tcl/Tk</b> using DejaGnu.</li>\
    </ul>\
    </div>\
    </td>\
    </tr>\
    <td class=\"grey2 greyj\" width=170 valign=top>\
    <div class=mqig>\
    <font class=orb>QASE&trade</font><br />\
    </div>\
    </td>\
    <td class=\"grey4 greyj\" width=342>\
    <div class=mvig>\
    <font class=orb>Director of Marketing</font>\
    </div>\
    <div class=mvig>\
    <ul class=ul2>\
    <li class=li2>Worte marketing plan.</li>\
    <li class=li2>Developed marketing collateral material.</li>\
    <li class=li2>Established reference accounts and closed $3 million in new business.</li>\
    <ul class=ul2>\
    <li class=li2>Tandem Computers</li>\
    <li class=li2>Cadence Design Systems</li>\
    <li class=li2>Abbot Laboratories</li>\
    </ul>\
    </ul>\
    </div>\
    </td>\
    </tr>\
    <td class=\"grey2 greyj\" width=170 valign=top>\
    <div class=mqig>\
    <font class=orb>amdahl</font><br />\
    </div>\
    </td>\
    <td class=\"grey5 greyj\" width=342>\
    <div class=mvig>\
    <font class=orb>Technical Marketing Specialist</font>\
    </div>\
    <div class=mvig>\
    <ul class=ul2>\
    <li class=li2>Performed executive briefings for fortune 100 customers.</li>\
    <li class=li2>Performed marketing analysis for national sales force.</li>\
    <li class=li2>Represented Open Systems Marketing on the 4655 FEP product development team. Wrote and executed the product prototype plan and established three high profile reference account in support of marketing efforts.</li>\
    <ul class=ul2>\
    <li class=li2>NCSA at the University of Illinois</li>\
    <ul class=ul2>\
    <li class=li2>Participated in the first National Science Foundation FDDI test bed.</li>\
    <li class=li2>Deployed first UniTree&trade HSM outside of Lawrence Livermore National Laboratory.</li>\
    </ul>\
    <li class=li2>University of Southern Californial</li>\
    <li class=li2>University of California San Diego</li>\
    </ul>\
    </ul>\
    </ul>\
    </div>\
    </td>\
    </tr>\
    <td class=\"grey2 greyj\" width=170 valign=top>\
    </td>\
    <td class=\"grey6 greyj\" width=342>\
    <div class=mvig>\
    <font class=orb>Software Engineer</font> Unix Systems Division\
    </div>\
    <div class=mvig>\
    <ul class=ul2>\
    <li class=li2>Wrote test plans, test cases, test scripts test harnesses and test summary reports.\
    </ul>\
    </div>\
    </td>\
    </tr>\
    <td class=\"grey2 greyj\" width=170 valign=top>\
    <div class=mqig>\
    <font class=orb>Siderial</font><br />\
    </div>\
    </td>\
    <td class=\"grey7 greyj\" width=342>\
    <div class=mvig>\
    <font class=orb>Engineer</font>\
    </div>\
    <div class=mvig>\
    <ul class=ul2>\
    <li class=li2>Hardware and Software Systems Engineer.</li>\
    <li class=li2>Customer Support Specialist.</li>\
    <li class=li2>Software Quality Assurance.</li>\
    <li class=li2>Hardware Quality Assurance.</li>\
    </ul>\
    </div>\
    </td>\
    </tr>\
    <td class=\"grey2 greyj\" width=170 valign=top>\
    <div class=mqig>\
    <font class=orb>United States Navy</font><br />\
    </div>\
    </td>\
    <td class=\"grey8 greyj\" width=342>\
    <div class=mvig>\
    <font class=orb>Electronics Technician</font>\
    </div>\
    <div class=mvig>\
    <ul class=ul2>\
    <li class=li2>Surface and aire search RADAR systems.</li>\
    <li class=li2>Satellite and OMEGA/LORAN navigation systems.</li>\
    <li class=li2>IFF systems.</li>\
    <li class=li2>RADAR and close circuit video distribution systems.</li>\
    <li class=li2>UHF, VHF and HF communication systems.</li>\
    </ul>\
    </div>\
    </td>\
    </tr>\
    <td class=\"grey2 greyj\" width=170 valign=top>\
    <td>\
    <object width=100%><embed src=http://www.android.com/swf/conveyor.swf type=application/x-shockwave-flash width=100% height=90></embed></object>\
    </td>\
    </tr>\
    </table>"
    #######################################################################
    #experience PAGE_MOBILE_LOW_END Generic page for low-end mobile devices
    #######################################################################
    PAGE_MOBILE_LOW_END = "\
    <div class=grey2>\
    <font class=odd>Todd</font> <font class=url>Url</font></font>\
    </div>\
    <div class=grey3>\
    </font><font class=odd>Founder and Chief Engineer of </font><font class=url>URL IS/IT</font>\
    </div>\
    <div class=grey2>\
    <font class=orb>Summary</font><br />\
    </div>\
    <div class=grey1>\
    <font class=orb>Information System Architect experienced in all phases of software and hardware development lifecycles.</font> Designed and executed performance and stress tests against global applications. Wrote and executed system and integration tests for large scale B2B projects. Identified requirements and reported coverage to client and IBM executives. Managed defects, issues and resolutions. Performed benchmarking and performance analysis of integrated information systems. Developed specialized tools to meet customer and application specific needs. Helped turn around problem projects. Strong strategic thinker with a can do attitude.\
    </div>\
    <div class=grey2>\
    <font class=orb>Areas of Expertise</font><br />\
    </div>\
    <div class=grey4>\
    <ul class=ul2>\
    <li class=li2><font class=orb>S</font>ervice <font class=orb>O</font>riented <font class=orb>A</font>rhitecture design, implementation and verification</li>\
    <li class=li2>System performance profiling, monitoring, stress testing and analysis</li>\
    <li class=li2>High availability, system fail-over and recovery verification</li>\
    <li class=li2>Network systems hardware, software, protocols and APIs</li>\
    <li class=li2>Database design, administration and performance tuning</li>\
    <li class=li2>Lotus Notes design, development and deployment</li>\
    <li class=li2>Unit, system and integration testing</li>\
    <li class=li2>Systems analysis and synthesis</li>\
    <li class=li2>Software tool development</li>\
    <li class=li2>Technical Marketing</li>\
    <li class=li2>Technical Sales</li>\
    <li class=li2>Programming</li>\
    </ul>\
    </div>\
    <div class=grey2>\
    <font class=orb>IBM Global Services&trade</font><br />\
    </div>\
    <div class=grey5>\
    <font class=orb>Philips Consumer Electronics</font> Developed system used to verify environment availability and readiness on demand and executed Failover and Recovery Test of large scale SOA for key IBM account.\
    </div>\
    <div class=mtig>\
    <ul class=ul2>\
    <li class=li2>Wrote and executed SOA Environment Verification Test Plan and Final Report.</li>\
    <li class=li2>Wrote and executed SOA System Fail-over and Recovery Test Plan and Final Report.</li>\
    <li class=li2>Developed integrated web service which continuously monitors and reports SOA availability, performance and service response time. Key personal are alerted via SMS upon failure of any infrastructure component, communication link or application subsystem. Metric history is maintained in DB2 and HTML summary reports including availability and performance histograms are delivered via SMTP.</li>\
    </ul>\
    </div>\
    <div class=grey2>\
    </div>\
    <div class=grey6>\
    <font class=orb>PartnerCommerce and PartnerCommerce/Servers</font> Executed end2end performance and stress testing against large scale B2B system. Wrote and maintained LoadRunner and WinRunner based test suites used to verify release readiness and response time history.\
    </div>\
    <div class=mtig>\
    <ul class=ul2>\
    <li class=li2>Verified performance characteristics of 4 major releases.</li>\
    <li class=li2>Measured system throughput and response time for all transactions.</li>\
    <li class=li2>Performed detailed analysis of page delivery and decomposition of response time components.</li>\
    <li class=li2>Measured system throughput and response time for all transactions.</li>\
    <li class=li2>Provided troubleshooting skills aided resolution of feature specific performance problems.</li>\
    <li class=li2>Measured transaction residence time at every component from Order Entry through TX Hub/InfoSource to SAP and back to order confirmation page.</li>\
    <li class=li2>Performed Application Profiling using Compuware Application Expert.</li>\
    </ul>\
    </div>\
    <div class=grey2>\
    </div>\
    <div class=grey4>\
    <font class=orb>PartnerInfo</font> Executed system, integration and performance test against world class Lotus Notes/Domino global information system.\
    </div>\
    <div class=mtig>\
    <ul class=ul2>\
    <li class=li2>Wrote system, integration and perfomance test plans, test cases, test scripts and test summary reports.</li>\
    <li class=li2>Designed and executed Global Notes Architecture replication benchmark.</li>\
    </ul>\
    </div>\
    <div class=grey2>\
    </div>\
    <div class=grey5>\
    <font class=greyj><font class=orb>Kodak Health Imaging Systems</font> Performed DB2 dataload analysis and resolved critical performance issues.\
    </div>\
    <div class=grey2>\
    </div>\
    <div class=grey6>\
    <font class=orb>Visa&trade Integreon Financial Systems</font> Performed System Test and aided customization and roll-out of \"turn-key\" CICS/COM/DCOM based web banking system for IBM reference accounts.\
    </div>\
    <div class=mtig>\
    <ul class=ul2>\
    <li class=li2>BankOne</li>\
    <li class=li2>Nations Bank</li>\
    </ul>\
    </div>\
    <div class=grey2>\
    <font class=orb>3Com</font><br />\
    </div>\
    <div class=grey4>\
    <font class=orb>Associate Architect, Corporate MIS.</font> Provided technical and project management support to lead Architect.\
    </div>\
    <div class=mvig>\
    <ul class=ul2>\
    <li class=li2>Assisted design and managed roll-out of multi-protocol global remote access facility.</li>\
    <li class=li2>Assisted design and managed roll-out of corporate <font class=orb>SONET OC3</font> backbone network.</li>\
    <li class=li2>Managed roll-out of global IP router backup, restore and software distribution system.</li>\
    </ul>\
    </div>\
    <div class=grey2>\
    </div>\
    <div class=grey5>\
    <font class=orb>Software Engineer, Network Systems Division.</font> Wrote test plans, test cases, test scripts and test summary reports.\
    </div>\
    <div class=mtig>\
    <ul class=ul2>\
    <li class=li2>Verified the <b>QOS</b> port queue metering algorithym of the 3Com NetBuilder multi-protocol router.</li>\
    <li class=li2>Automated test cases in <b>C</b> and <b>Tcl/Tk</b> using DejaGnu.</li>\
    </ul>\
    </div>\
    <div class=grey2>\
    <font class=orb>QASE&trade</font><br />\
    </div>\
    <div class=grey4>\
    <font class=orb>Director of Marketing</font>\
    </div>\
    <div class=mvig>\
    <ul class=ul2>\
    <li class=li2>Worte marketing plan.</li>\
    <li class=li2>Developed marketing collateral material.</li>\
    <li class=li2>Established reference accounts and closed $3 million in new business.</li>\
    <ul class=ul2>\
    <li class=li2>Tandem Computers</li>\
    <li class=li2>Cadence Design Systems</li>\
    <li class=li2>Abbot Laboratories</li>\
    </ul>\
    </ul>\
    </div>\
    <div class=grey2>\
    <font class=orb>amdahl</font><br />\
    </div>\
    <div class=grey5>\
    <font class=orb>Technical Marketing Specialist</font>\
    </div>\
    <div class=mvig>\
    <ul class=ul2>\
    <li class=li2>Performed executive briefings for fortune 100 customers.</li>\
    <li class=li2>Performed marketing analysis for national sales force.</li>\
    <li class=li2>Represented Open Systems Marketing on the 4655 FEP product development team. Wrote and executed the product prototype plan and established three high profile reference account in support of marketing efforts.</li>\
    <ul class=ul2>\
    <li class=li2>NCSA at the University of Illinois</li>\
    <ul class=ul2>\
    <li class=li2>Participated in the first National Science Foundation FDDI test bed.</li>\
    <li class=li2>Deployed first UniTree&trade HSM outside of Lawrence Livermore National Laboratory.</li>\
    </ul>\
    <li class=li2>University of Southern Californial</li>\
    <li class=li2>University of California San Diego</li>\
    </ul>\
    </ul>\
    </ul>\
    </div>\
    <div class=grey6>\
    <font class=orb>Software Engineer</font> Unix Systems Division\
    </div>\
    <div class=mvig>\
    <ul class=ul2>\
    <li class=li2>Wrote test plans, test cases, test scripts test harnesses and test summary reports.\
    </ul>\
    </div>\
    <div class=grey2>\
    <font class=orb>Siderial</font><br />\
    </div>\
    <div class=grey7>\
    <font class=orb>Engineer</font>\
    </div>\
    <div class=mvig>\
    <ul class=ul2>\
    <li class=li2>Hardware and Software Systems Engineer.</li>\
    <li class=li2>Customer Support Specialist.</li>\
    <li class=li2>Software Quality Assurance.</li>\
    <li class=li2>Hardware Quality Assurance.</li>\
    </ul>\
    </div>\
    <div class=grey2>\
    <font class=orb>United States Navy</font><br />\
    </div>\
    <div class=grey8>\
    <font class=orb>Electronics Technician</font>\
    </div>\
    <div class=mvig>\
    <ul class=ul2>\
    <li class=li2>Surface and aire search RADAR systems.</li>\
    <li class=li2>Satellite and OMEGA/LORAN navigation systems.</li>\
    <li class=li2>IFF systems.</li>\
    <li class=li2>RADAR and close circuit video distribution systems.</li>\
    <li class=li2>UHF, VHF and HF communication systems.</li>\
    </ul>\
    </div>\
    <object width=100%><embed src=http://www.android.com/swf/conveyor.swf type=application/x-shockwave-flash width=100% height=90></embed></object>"
    global DEVICE
    detectDevice()
    if DEVICE == "MOBILE_LOW_END":
      self.response.out.write(PAGE_HEADER_MOBILE_LOW_END)
      self.response.out.write(STYLE_SHEET_MOBILE_LOW_END)
      self.response.out.write(MAIN_MENU_MOBILE_LOW_END)
      self.response.out.write(PAGE_MOBILE_LOW_END)
      self.response.out.write(PAGE_FOOTER_MOBILE_LOW_END)
    if DEVICE == "DESKTOP":
      self.response.out.write(PAGE_HEADER_DESKTOP)
      self.response.out.write(STYLE_SHEET_DESKTOP)
      self.response.out.write(MAIN_MENU_DESKTOP)
      self.response.out.write(PAGE_DESKTOP)
      self.response.out.write(PAGE_FOOTER_DESKTOP)

######################################################
#Services PAGE describes the types of services offered
######################################################
class services(webapp.RequestHandler):
  def get(self):
    global PAGE_HEADER_DESKTOP
    PAGE_HEADER_DESKTOP = PAGE_HEADER_DESKTOP.replace("URL IS/IT", "URL IS/IT - Services")
    ########################################################
    #services PAGE_DESKTOP Generic page for DESKTOP browsers
    ########################################################
    PAGE_DESKTOP = "\
    <table width=684 border=0 cellpadding=0 cellspacing=0 summary=content>\
    <tr valign=top>\
    <td rowspan=1 class=\"grey2 greyj\" width=342>\
    <div class=mhead>\
    <font class=odd>Services </font><font class=url>Overview</font>\
    </div>\
    <div class=mstd>\
    <font class=orb>\
    URL IS/IT provides on-site technical staffing services to companies in the United States.\
    </font>\
    <font class=norm>\
    We become valuable members of your team, enthusiastically pursuing and accomplishing our assigned objectives. \
    We document all our work products, and make sure they get properly handed off to permanent members of your staff. \
    Each week we account for billable hours and then, upon your approval, invoice monthly.  There are no long term \
    contracts unless required as part of your business process.  You simply inform us our services are no longer \
    required.  Past engagements include:\
    </div>\
    <img id=\"AK\" src=img/ibm.gif width=110 height=50 alt=\"IBM Global Services\" />\
    <div class=\"serviceslfltlft\">\
    <a href=Experience class=link>IBM Global Services&trade;</a>\
    The world's largest information technology services and consulting provider, IBM Global Services helps clients \
    integrate information technology with business.\
    </div>\
    <img id=\"AL\" src=img/3com.gif width=110 height=70 alt=3Com />\
    <div class=\"serviceslfltlft\">\
    <a href=Experience class=link>3Com Corporation</a>\
    3Com provides secure, converged networking solutions on a global scale to businesses of all sizes. Its products and \
    solutions enable customers to manage business critical voice and data in a secure and efficient network environment.\
    </font>\
    </div>\
    </td>\
    <td class=\"grey3 greyj\" width=342>\
    <div class=mhead>\
    <font class=odd>Services </font><font class=url>List</font>\
    </div>\
    <div class=mstd>\
    <font class=orb>\
    URL IS/IT is committed to providing technical services which exceed your expectations in the following areas:\
    </font>\
    <ul class=ul>\
    <li class=li2>Google&#153 App Engine programming in python</li>\
    <li class=li2>Google&#153 App Engine software QA in Java</li>\
    <li class=li2>Android software QA</li>\
    <li class=li2>Document automation in Google&#153 App Script</li>\
    <li class=li2>Lotus Notes migration to Google&#153 Apps</li>\
    <li class=li2>Website migration to Google&#153 Sites</li>\
    <li class=li2>Database migration to the Google&#153 Datastore</li>\
    <li class=li2>AJAX programming using the Google&#153 Web Toolkit</li>\
    </ul>\
    </div>\
    <div class=mstd>\
    <font class=orb>\
    We also have extensive experience in:\
    </font>\
    <ul class=ul>\
    <li class=li2>Performance analysis, benchmarking and stress testing</li>\
    <li class=li2>Writing and executing test plans and test cases</li>\
    <li class=li2>Automating test case execution</li>\
    </ul>\
    </div>\
    </td>\
    </tr>\
    </table>"
    #####################################################################
    #services PAGE_MOBILE_LOW_END Generic page for low-end mobile devices
    #####################################################################
    PAGE_MOBILE_LOW_END = "\
    <div class=grey2>\
    <font class=odd>Services </font><font class=url>Overview</font>\
    </div>\
    <div class=grey2>\
    <font class=orb>\
    URL IS/IT provides on-site technical staffing services to companies in the United States.\
    </font>\
    </div>\
    <div class=grey2>\
    <font class=norm>\
    We become valuable members of your team, enthusiastically pursuing and accomplishing our assigned objectives. \
    We document all our work products, and make sure they get properly handed off to permanent members of your staff. \
    Each week we account for billable hours and then, upon your approval, invoice monthly.  There are no long term \
    contracts unless required as part of your business process.  You simply inform us our services are no longer \
    required.  Past engagements include:\
    </font>\
    </div>\
    <div class=grey2>\
    <a href=Experience class=link>IBM Global Services&trade;</a>\
    <font class=norm>\
    The world's largest information technology services and consulting provider, IBM Global Services helps clients \
    integrate information technology with business.\
    </font>\
    </div>\
    <div class=grey2>\
    <a href=Experience class=link>3Com Corporation</a>\
    <font class=norm>\
    3Com provides secure, converged networking solutions on a global scale to businesses of all sizes. Its products \
    and solutions enable customers to manage business critical voice and data in a secure and efficient network environment.\
    </font>\
    </div>\
    <div class=grey3>\
    <font class=odd>Services </font><font class=url>List</font>\
    </div>\
    <div class=grey3>\
    <font class=orb>\
    URL IS/IT is committed to providing technical services which exceed your expectations in the following areas:\
    </font>\
    </div>\
    <font class=norm>\
    <div class=grey3>\
    Google&#153 App Engine programming in python\
    </div>\
    <div class=grey3>\
    Google&#153 App Engine software QA in Java\
    </div>\
    <div class=grey3>\
    Android software QA\
    </div>\
    <div class=grey3>\
    Document automation in Google&#153 App Script\
    </div>\
    <div class=grey3>\
    Lotus Notes migration to Google&#153 Apps\
    </div>\
    <div class=grey3>\
    Website migration to Google&#153 Sites\
    </div>\
    <div class=grey3>\
    Database migration to the Google&#153 Datastore\
    </div>\
    <div class=grey3>\
    AJAX programming using the Google&#153 Web Toolkit\
    </div>\
    </font>\
    <div class=grey3>\
    <font class=orb>\
    We also have extensive experience in:\
    </font>\
    </div>\
    <font class=norm>\
    <div class=grey3>\
    Performance analysis, benchmarking and stress testing\
    </div>\
    <div class=grey3>\
    Writing and executing test plans and test cases\
    </div>\
    <div class=grey3>\
    Automating test case execution\
    </div>\
    </font>"
    global DEVICE
    detectDevice()
    if DEVICE == "MOBILE_LOW_END":
      self.response.out.write(PAGE_HEADER_MOBILE_LOW_END)
      self.response.out.write(STYLE_SHEET_MOBILE_LOW_END)
      self.response.out.write(MAIN_MENU_MOBILE_LOW_END)
      self.response.out.write(PAGE_MOBILE_LOW_END)
      self.response.out.write(PAGE_FOOTER_MOBILE_LOW_END)
    if DEVICE == "DESKTOP":
      self.response.out.write(PAGE_HEADER_DESKTOP)
      self.response.out.write(STYLE_SHEET_DESKTOP)
      self.response.out.write(MAIN_MENU_DESKTOP)
      self.response.out.write(PAGE_DESKTOP)
      self.response.out.write(PAGE_FOOTER_DESKTOP)

#################################################### 
#solutions PAGE describes turn-key solutions offered
#################################################### 
class solutions(webapp.RequestHandler):
  def get(self):
    global PAGE_HEADER_DESKTOP
    PAGE_HEADER_DESKTOP = PAGE_HEADER_DESKTOP.replace("URL IS/IT", "URL IS/IT - Solutions")
    #########################################################
    #solutions PAGE_DESKTOP Generic page for DESKTOP browsers
    #########################################################
    PAGE_DESKTOP = "\
    <table width=684 border=0 cellpadding=0 cellspacing=0 summary=content>\
    <tr valign=top>\
    <td rowspan=2 class=\"grey2 greyj\" width=342>\
    <div class=mhead>\
    <font class=odd>Turn-key </font><font class=url>Solutions</font>\
    </div>\
    <div class=mstd>\
    <font class=orb>\
    URL IS/IT migrates your existing website to Google App Engine&#153.\
    </font>\
    It's the ideal solution for leveraging Google's technology suite while maintaining the <b>exact look \
    and feel</b> you've grown accustomed to. With us the first step into the cloud is easy and inexpensive. \
    What's in it for you? How about gaining access to a mind boggling array of Google APIs as well as being \
    liberated from the cost associated with maintaining an IS/IT infrastructure. That's right, the fact is \
    App Engine is <b>free</b> if you're within Google's generous \
    <a class=link href=http://code.google.com/appengine/docs/quotas.html>quotas</a>, and it's competitively \
    <a class=link href=http://code.google.com/appengine/docs/billing.html>priced</a> when they're exceeded. \
    We charge $24 for migrating a website to App Engine, and provide 24 hour phone support for $24 per hour. \
    That's our 24x24x24 turnkey solution. It's easy to build, easy to maintain and easy on the budget.\
    </div>\
    <div class=mstd>\
    <font class=orb>\
    Website migration to webapp with Google App Engine&trade $24\
    </font> \
    We migrate the static content of your website into Google App Engine&trade and deliver to you a fully \
    functional webapp in Python. This approach preserves your HTML, css and JavaScript investment and ensures \
    the look and feel remain unchanged. Now you'll have access to all the Google&trade APIs, in addition to AJAX. \
    Easly easily integrate your site with the Google&trade Apps user accounts you already have by using the \
    Users Service API. Add database support by implementing your data model using the Datastore API. If your \
    staff and other contributors generate content, serve it using the Django template API. Use the Mail API to \
    deliver content. The list goes on, and you can count on Google&#153 to relentlessly add more. Like the \
    possibilities but don't want to program? No problem, as a 24x24 customer you'll have access to our \
    Solution showcase and the ability to implement those solutions for a fixed price.  Click the \
    <a class=link href=#>URL IS/IT 24x24 solution</a> \
    link to start migrating your site to Google&#153 App Engine, you'll be glad you did.\
    </div>\
    <div class=mstd>\
    <font class=orb>\
    24 hour support $24 per hour\
    </font> \
    Solution customers can call us for support any time of day, any day of the week with regards to any solution \
    work performed. That's 40 cents a minute billed in 15 minute intervals to speak with a real programmer who's \
    familiar with your specific needs. We find most problems can be resolved in a few minutes, and those that \
    require a code change are either defects covered by warranty, and consequently repaired at no cost, or are \
    enhancements which can be performed at the custom solutions rate of $35 per hour. This approach to customer \
    service is intended to build meaningful relationships by ensuring you receive prompt technical resolution to \
    any problems encountered and we're assured modest but fair compensation for resulting as no fault of our own. \
    Click the \
    <a class=link href=#>URL IS/IT Solutions Support</a> \
    link now if you are a solutions customer with a problem.  Or better yet, give us a call, you know the number.\
    </div>\
    </td>\
    <td class=\"grey3 greyj\" width=342>\
    <div class=mhead>\
    <font class=odd>Solution </font><font class=url>Showcase</font>\
    </div>\
    <div class=mstd>\
    <font class=orb>\
    Fixed price solution packages available to solution customers.\
    </font>\
    Solution packages are built on relationships forged from confidence and trust. Our confidence that we \
    can perform the work quickly without making too many mistakes, and your trust in us to deliver warrantied \
    work products on time for a fixed price.\
    <ul class=ul>\
    <li class=li2><a href=# class=link>Google&#153 Apps account login via Users Service API</a></li>\
    <li class=li2><a href=# class=link>Datastore model implementation based on provided tables</a></li>\
    <li class=li2><a href=# class=link>Email delivery based on Gmail&#153 contacts list</a></li>\
    <li class=li2><a href=# class=link>OpenID authentication via the Federated Logn API</a></li>\
    <li class=li2><a href=# class=link>Google&#153 Apps controlled group calender</a></li>\
    <li class=li2><a href=# class=link>Performance profiling, monitoring and load testing</a></li>\
    </ul>\
    </div>\
    </td>\
    </tr>\
    <td valign=top class=\"grey1 greyj\">\
    <div class=mhead>\
    <font class=odd>Custom </font><font class=url>Solutions</font>\
    </div>\
    <div class=mstd>\
    <font class=orb>\
    Reduced rates for custom development available to solution customers.\
    </font>\
    By working with our most valued customers though the requirements phase <b>at no charge</b>, phase we produce \
    a mutually agreed upon Statement Of Work which offers the same benefits of as a packaged solution independent \
    of the restrictions on scope.\
    </div>\
    </td>\
    </tr>\
    </table>"
    ######################################################################
    #solutions PAGE_MOBILE_LOW_END Generic page for low-end mobile devices
    ######################################################################
    PAGE_MOBILE_LOW_END = "\
    <div class=grey2>\
    <font class=odd>Turn-key </font><font class=url>Solutions</font>\
    </div>\
    <div class=grey2>\
    <font class=orb>\
    URL IS/IT migrates your existing website to Google App Engine&#153.\
    </font>\
    </div>\
    <div class=grey2>\
    <font class=norm>\
    It's the ideal solution for leveraging Google's technology suite while maintaining \
    the <b>exact look and feel</b> you've grown accustomed to. With us the first step \
    into the cloud is easy and inexpensive. What's in it for you? How about gaining \
    access to a mind boggling array of Google APIs as well as being liberated from the \
    cost associated with maintaining an IS/IT infrastructure. That's right, the fact \
    is App Engine is <b>free</b> if you're within Google's generous <a class=link \
    href=http://code.google.com/appengine/docs/quotas.html>quotas</a>, and it's competitively \
    <a class=link href=http://code.google.com/appengine/docs/billing.html>priced</a> when \
    they're exceeded. We charge $24 for migrating a website to App Engine, and provide 24 \
    hour phone support for $24 per hour. That's our 24x24x24 turnkey solution. It's easy \
    to build, easy to maintain and easy on the budget.\
    </div>\
    <div class=grey2>\
    <font class=orb>\
    Website migration to webapp with Google App Engine&trade $24.\
    </font>\
    </div>\
    <div class=grey2>\
    We migrate the static content of your website into Google App Engine&trade and \
    deliver to you a fully functional webapp in Python. This approach preserves your \
    HTML, css and JavaScript investment and ensures the look and feel remain\
    unchanged. Now you'll have access to all the Google&trade APIs, in addition to \
    AJAX.  Easly easily integrate your site with the Google&trade Apps user accounts \
    you already have by using the Users Service API. Add database support by implementing \
    your data model using the Datastore API. If your staff and other contributors \
    generate content, serve it using the Django template API. Use the Mail API to \
    deliver content. The list goes on, and you can count on Google&#153 to relentlessly \
    add more. Like the possibilities but don't want to program? No problem, as a 24x24 \
    customer you'll have access to our Solution showcase and the ability to implement \
    those solutions for a fixed price.  Click the \
    <a class=link href=#>URL IS/IT 24x24 solution</a>\
    link to start migrating your site to Google&#153 App Engine, you'll be glad you did.\
    </div>\
    <div class=grey2>\
    <font class=orb>\
    24 hour support $24 per hour\
    </font>\
    </div>\
    <div class=grey2>\
    Solution customers can call us for support any time of day, any day of the week \
    with regards to any solution work performed. That's 40 cents a minute billed in \
    15 minute intervals to speak with a real programmer who's familiar with your \
    specific needs. We find most\
    problems can be resolved in a few minutes, and those that require a code change \
    are either defects covered by warranty, and consequently repaired at no cost, or \
    are enhancements which can be performed at the custom solutions rate of $35 per hour. \
    This approach to customer service is intended to build meaningful relationships \
    by ensuring you receive prompt technical resolution to any problems encountered \
    and we're assured modest but fair compensation for resulting as no fault of our own. \
    Click the \
    <a class=link href=#>URL IS/IT Solutions Support</a>\
    link now if you are a solutions customer with a problem.  Or better yet, give us a \
    call, you know the number.\
    </div>\
    <div class=grey3>\
    <font class=odd>Solution </font><font class=url>Showcase</font>\
    </div>\
    <div class=grey3>\
    <font class=orb>\
    Fixed price solution packages available to solution customers.\
    </font>\
    </div>\
    <div class=grey3>\
    Solution packages are built on relationships forged from confidence and trust. \
    Our confidence that we can perform the work quickly without making too many mistakes, \
    and your trust in us to deliver warrantied work products on time for a fixed price.\
    </div>\
    <div class=grey3>\
    <a href=# class=link>Google&#153 Apps account login via Users Service API</a>\
    </div>\
    <div class=grey3>\
    <a href=# class=link>Datastore model implementation based on provided tables</a>\
    </div>\
    <div class=grey3>\
    <a href=# class=link>Email delivery based on Gmail&#153 contacts list</a>\
    </div>\
    <div class=grey3>\
    <a href=# class=link>OpenID authentication via the Federated Logn API</a>\
    </div>\
    <div class=grey3>\
    <a href=# class=link>Google&#153 Apps controlled group calender</a>\
    </div>\
    <div class=grey3>\
    <a href=# class=link>Performance profiling, monitoring and load testing</a>\
    </div>\
    <div class=grey1>\
    <font class=odd>Custom </font><font class=url>Solutions</font>\
    </div>\
    <div class=grey1>\
    <font class=orb>\
    Reduced rates for custom development available to solution customers.\
    </font>\
    </div>\
    <div class=grey1>\
    By working with our most valued customers though the requirements phase <b>at no \
    charge</b>, phase we produce a mutually agreed upon Statement Of Work which offers \
    the same benefits of as a packaged solution independent of the restrictions on scope.\
    </div>"
    global DEVICE
    detectDevice()
    if DEVICE == "DESKTOP":
      self.response.out.write(PAGE_HEADER_DESKTOP)
      self.response.out.write(STYLE_SHEET_DESKTOP)
      self.response.out.write(MAIN_MENU_DESKTOP)
      self.response.out.write(PAGE_DESKTOP)
      self.response.out.write(PAGE_FOOTER_DESKTOP)
    if DEVICE == "MOBILE_LOW_END":
      self.response.out.write(PAGE_HEADER_MOBILE_LOW_END)
      self.response.out.write(STYLE_SHEET_MOBILE_LOW_END)
      self.response.out.write(MAIN_MENU_MOBILE_LOW_END)
      self.response.out.write(PAGE_MOBILE_LOW_END)
      self.response.out.write(PAGE_FOOTER_MOBILE_LOW_END)

############################################################
#support PAGE provides access to the Online Support Facility
############################################################
class support(webapp.RequestHandler):
  def get(self):
    global PAGE_HEADER_DESKTOP
    PAGE_HEADER_DESKTOP = PAGE_HEADER_DESKTOP.replace("URL IS/IT", "URL IS/IT - Support")
    #######################################################
    #support PAGE_DESKTOP Generic page for DESKTOP browsers
    #######################################################
    PAGE_DESKTOP = "\
    <table width=684 border=0 cellpadding=0 cellspacing=0 summary=content>\
    <tr valign=top>\
    <td rowspan=2 class=\"grey2 greyj\" width=342>\
    <div class=mhead>\
    <font class=odd>Online </font><font class=url>Support Facility</font>\
    </div>\
    <div class=mstd>\
    <font class=orb>\
    Please use our Google&#153 Apps based Online Support Facility, \
    </font>\
    it provides customers and staff alike with a secure online method of performing support tasks. \
    The system employs Google&trade App Engine authentication based on your Google&trade user ID. \
    If you are currently logged into your Gmail (or any Google&trade App), clicking our \
    <a href=" + users.create_login_url("/html/Staff.html") + ">\
    <font class=link>\
    Online Support Facility\
    </font>\
    </a>\
    link automatically authenticates and directs you to your individual URL IS/IT account and facility options available.\
    Select <a class=link href=" + users.create_login_url("html/Staff.html") + ">Online Support Facility<a> if you are a \
    staff member or customer and you have a Google&#153 account user ID. If you are <b>not</b> currently logged into your \
    Google&#153 account, App Engine&#153 Authentication Services will direct you to a Google&#153 login page and return \
    you to our site once you've been authenticated by Google&#153.\
    </div>\
    </td>\
    <td class=\"grey1 greyj\" width=342>\
    <div class=mhead>\
    <font class=odd>Customer </font><font class=url>Support</font>\
    </div>\
    <div class=mstd>\
    <font class=orb>\
    We use online service support tools to ensure customer and staff satisfaction.\
    </font>\
    Our <a class=link href=" + users.create_login_url("/html/Staff.html") + ">Online Support Facility</a>\
    provides portal access for customers and staff who wish to perform a variety of common tasks. For example:\
    <ul class=ul>\
    <li class=li2>Staff members fill out their time cards</li>\
    <li class=li2>Service customers sign time cards and pay invoices</li>\
    <li class=li2>Solution customers define and order custom solutions</li>\
    <li class=li2>Product customers report product related issues</li>\
    </ul>\
    <a href=" + users.create_login_url("/html/Staff.html") + ">\
    </div>\
    </td>\
    </tr>\
    <tr>\
    <td valign=top class=\"grey3 greyj\">\
    <div class=mhead>\
    <font class=odd>OpenID/OAuth </font><font class=url>SSO</font>\
    </div>\
    <div class=mstd>\
    <font class=orb>\
    If you don't have a Google&#153 account you'll still be able to access our Online Support Facility using \
    <b>OpenID</b>.\
    </font>\
    We're an OpenID Relying Party (implemented using the Google&#153 Federated Login API). \
    Select your OpenID provider from the list below and we'll trust them to authenticate you.\
    </div>\
    <div class=mstd>\
    <img id=AJ src=img/OpenID.gif width=300 height=208 alt=\"OpenID Logo\" />\
    </div>\
    </td>\
    </tr>\
    </table>"
    ####################################################################
    #support PAGE_MOBILE_LOW_END Generic page for low-end mobile devices
    ####################################################################
    PAGE_MOBILE_LOW_END = "\
    <div class=grey1>\
    <font class=odd>Customer </font><font class=url>Support</font>\
    </div>\
    <div class=grey1>\
    <font class=orb>\
    We use online service support tools to ensure customer and staff satisfaction.\
    </font>\
    </div>\
    <div class=grey1>\
    <font class=norm>\
    Our <a class=link href=" + users.create_login_url("/html/Staff.html") + ">\
    Online Support Facility</a> \
    provides portal access for customers and staff who wish to perform a variety of \
    common tasks. For example:\
    </div>\
    <div class=grey1>\
    Staff members fill out their time cards\
    </div>\
    <div class=grey1>\
    Service customers sign time cards and pay invoices\
    </div>\
    <div class=grey1>\
    Solution customers define and order custom solutions\
    </div>\
    <div class=grey1>\
    Product customers report product related issues\
    </div>\
    <div class=grey3>\
    <a href=" + users.create_login_url("/html/Staff.html") + ">\
    <font class=odd>Online </font><font class=url>Support Facility</font></a>\
    </div>\
    <div class=grey3>\
    <font class=orb>\
    Our Google&trade Apps based \
    <a class=link href=" + users.create_login_url("/html/Staff.html") + ">\
    Online Support Facility</a></font> provides customers and staff alike with \
    a secure online method of performing support tasks.  The system employs \
    Google&trade App Engine authentication based on your Google&trade user ID. \
    If you are currently logged into your Gmail (or any Google&trade App), \
    clicking our \
    <a href=" + users.create_login_url("/html/Staff.html") + ">\
    <font class=link>Online Support Facility</font>\
    </a> link automatically authenticates and directs you to your individual \
    URL IS/IT account and facility options available.\
    </div>\
    <div class=grey3>\
    Select \
    <a class=link href=" + users.create_login_url("/html/Staff.html") + ">\
    Online Support Facility\
    <a> if you are a staff member or customer and you have a Google&#153 account \
    user ID. \
    </div>\
    <div class=grey3>\
    If you are <b>not</b> currently logged into your Google&#153 account, \
    App Engine&#153 Authentication Services will direct you to a Google&#153 login \
    page and return you to our site once you've been authenticated by Google&#153.\
    </div>\
    <div class=grey3>\
    <font class=orb>\
    If you don't have a Google&#153 account you'll still be able to access our Online \
    Support Facility using <b>OpenID</b>.\
    </font> \
    We're an OpenID Relying Party (implemented using the Google&#153 Federated Login API). \
    Select your OpenID provider from the list below and we'll trust them to authenticate you.\
    </div>\
    <div class=grey2>\
    <font class=odd>Product </font><font class=url>Support</font>\
    </div>\
    <div class=grey2>\
    <font class=orb>URLimporter&trade</font>\
    </div>\
    <div class=grey2>\
    Use this link to report a problem with the URLimporter. \
    <a href=" + users.create_login_url("/html/Staff.html") + " class=link>Online Support Facility</a>\
    <font class=orb>Notes Migrator&trade</font>\
    </div>\
    <div class=grey2>\
    Use this link to report a problem with the Lotus Notes Migrator.\
    <a href=" + users.create_login_url("/html/Staff.html") + " class=link>Online Support Facility</a>\
    </div>"
    global DEVICE
    detectDevice()
    if DEVICE == "DESKTOP":
      self.response.out.write(PAGE_HEADER_DESKTOP)
      self.response.out.write(STYLE_SHEET_DESKTOP)
      self.response.out.write(MAIN_MENU_DESKTOP)
      self.response.out.write(PAGE_DESKTOP)
      self.response.out.write(PAGE_FOOTER_DESKTOP)
    if DEVICE == "MOBILE_LOW_END":
      self.response.out.write(PAGE_HEADER_MOBILE_LOW_END)
      self.response.out.write(STYLE_SHEET_MOBILE_LOW_END)
      self.response.out.write(MAIN_MENU_MOBILE_LOW_END)
      self.response.out.write(PAGE_MOBILE_LOW_END)
      self.response.out.write(PAGE_FOOTER_MOBILE_LOW_END)

################################################
#products PAGE provides descriptions of products
################################################
class products(webapp.RequestHandler):
  def get(self):
    global PAGE_HEADER_DESKTOP
    PAGE_HEADER_DESKTOP = PAGE_HEADER_DESKTOP.replace("URL IS/IT", "URL IS/IT - Products")
    ########################################################
    #products PAGE_DESKTOP Generic page for DESKTOP browsers
    ########################################################
    PAGE_DESKTOP = "\
    <table width=684 border=0 cellpadding=0 cellspacing=0 summary=content>\
    <tr valign=top>\
    <td class=\"grey2 greyj\" width=342>\
    <div class=mhead>\
    <font class=odd>About our </font><font class=url>Products</font>\
    </div>\
    <div class=mstd>\
    <font class=orb>Useful tools made available by URL IS/IT as SaaS offerings.</font>\
    We develop tools in order to offer packaged solutions to our customers at competitive prices. Let's face it, \
    if we had to copy and paste lines of HTML into a Python webapp skeleton we would need to charge $2,400 instead \
    of $24. As long as the input domain is well understood and the kinks ironed out, tools enable us to perform \
    tedious time consuming tasks at the push of a button without making mistakes. This caveat highlights their \
    weakness (inflexibility) as well their strength. Consider the following command line.\
    </div>\
    <div class=mstd>\
    <font class=orb>$ urlget http://website.com | html2webapp -p | addusrsvc -p | genDatastore -p -i tables.ddl | appcfg.py -email foobar@gmail.com -passin update webapp/</font>\
    </div>\
    <div class=mstd>\
    Our products are made available via App Engine and payment is accepted via PayPal. Click appropriate in link \
    in our Product Showcase for product specific information.\
    </div>\
    </td>\
    <td class=\"grey3 greyj\" width=342>\
    <div class=mhead>\
    <font class=odd>Product </font><font class=url>Showcase</font>\
    </div>\
    <div class=mstd>\
    <font class=orb>URL IS/IT products help webmasters and VARs migrate websites to Google&#153 App Engine.</font>\
    </div>\
    <img id=\"AM\" src=img/b001.gif width=91 height=48 alt=\"URL Importer for web\" />\
    <div class=serviceslfltlft>\
    URLimporter copies the static content of any website and generates an App Engine ready webapp in python. \
    URLimporter can even upload the converted webapp for you. URLimporter costs $10 per use, payable via PayPal.\
    <a href=# class=link>Access URLimporter for web</a>\
    </div>\
    <img id=\"AN\" src=img/b002.gif width=91 height=48 alt=\"URL Importer for Android\" />\
    </div>\
    <div class=serviceslfltlft>\
    URLimporter for Android copies the static content of any website and generates an App Engine ready webapp in python. URLimporter can even upload the converted webapp for you. URLimporter costs $10 per use, payable via paypal.\
    <a href=# class=link>Download URLimporter for Android</a>\
    </div>\
    </td>\
    </tr>\
    </table>"
    #####################################################################
    #products PAGE_MOBILE_LOW_END Generic page for low-end mobile devices
    #####################################################################
    PAGE_MOBILE_LOW_END = "\
    <div class=grey2>\
    <font class=odd>About our </font><font class=url>Products</font>\
    </div>\
    <div class=grey2>\
    <font class=norm>\
    <font class=orb>\
    Useful tools made available by URL IS/IT as SaaS offerings.\
    </font>\
    We develop tools in order to offer packaged solutions to our customers at competitive \
    prices. Let's face it, if we had to copy and paste lines of HTML into a Python webapp \
    skeleton we would need to charge $2,400 instead of $24. As long as the input domain is \
    well understood and the kinks ironed out, tools enable us to perform tedious time \
    consuming tasks at the push of a button without making mistakes. This caveat highlights \
    their weakness (inflexibility) as well their strength. Consider the following command line.\
    </div>\
    <div class=grey2>\
    <font class=orb>\
    $ urlget http://website.com | html2webapp -p | addusrsvc -p | genDatastore -p -i tables.ddl | appcfg.py -email foobar@gmail.com -passin update webapp/\
    </font>\
    </div>\
    <div class=grey2>\
    Our products are made available via App Engine and payment is accepted via PayPal. Click \
    appropriate in link in our Product Showcase for product specific information.\
    <div class=grey3>\
    <font class=odd>Product </font><font class=url>Showcase</font>\
    </div>\
    <div class=grey3>\
    <font class=orb>\
    URL IS/IT products help webmasters and VARs migrate websites to Google&#153 App Engine.\
    </font>\
    </div>\
    <div class=grey3>\
    URLimporter copies the static content of any website and generates an App Engine ready webapp in python. \
    URLimporter can even upload the converted webapp for you. URLimporter costs $10 per use, payable via PayPal.\
    </div>\
    <div class=grey3>\
    <a href=# class=link>Access URLimporter for web</a>\
    </div>\
    <div class=grey3>\
    URLimporter for Android copies the static content of any website and generates an App Engine ready webapp \
    in python. URLimporter can even upload the converted webapp for you. URLimporter costs $10 per use, payable via paypal.\
    </div>\
    <div class=grey3>\
    <a href=# class=link>Download URLimporter for Android</a>\
    </font>\
    </div>"
    global DEVICE
    detectDevice()
    if DEVICE == "DESKTOP":
      self.response.out.write(PAGE_HEADER_DESKTOP)
      self.response.out.write(STYLE_SHEET_DESKTOP)
      self.response.out.write(MAIN_MENU_DESKTOP)
      self.response.out.write(PAGE_DESKTOP)
      self.response.out.write(PAGE_FOOTER_DESKTOP)
    if DEVICE == "MOBILE_LOW_END":
      self.response.out.write(PAGE_HEADER_MOBILE_LOW_END)
      self.response.out.write(STYLE_SHEET_MOBILE_LOW_END)
      self.response.out.write(MAIN_MENU_MOBILE_LOW_END)
      self.response.out.write(PAGE_MOBILE_LOW_END)
      self.response.out.write(PAGE_FOOTER_MOBILE_LOW_END)

#############################################################################################################
#staff PAGE is the Online Support Facility (under construction, currently only available via desktop browsers
#############################################################################################################
class staff(webapp.RequestHandler):
  def get(self):
    user = users.get_current_user()
    if not user:
        PAGE_FOOTER_DESKTOP = ("</td></tr><tr><td align=center class=\"copy bgcopy\" height=64><font class=orb><a href=\"%s\" class=link>Login or register with Google&#153</a></font></td></tr><tr><td align=center height=18 class=web>&copy; 2009 Todd Url</td></tr></table></body></html>" % users.create_login_url("/html/Staff.html"))

        self.response.out.write(PAGE_HEADER_DESKTOP)
        self.response.out.write(STYLE_SHEET_DESKTOP)
        self.response.out.write(MAIN_MENU_DESKTOP)
        self.response.out.write("<table width=684 border=0 cellpadding=0 cellspacing=0 summary=content><tr valign=top>\n")
        self.response.out.write("<td class=\"grey2 greyj\" width=684>")
        self.response.out.write("<div class=mdig>\n")
        self.response.out.write("<font class=odd>Please click </font><font class=url>Login link</font><br /><br />\n")
        self.response.out.write("</div>\n")
        self.response.out.write("</td>\n")
        self.response.out.write("</tr>\n")
        self.response.out.write("</table>\n")
        self.response.out.write(PAGE_FOOTER_DESKTOP)
    else:
        if not users.is_current_user_admin():
            PAGE_FOOTER_DESKTOP = ("</td></tr><tr><td align=center class=\"copy bgcopy\" height=64><font class=orb><a href=\"%s\" class=link>Logout</a></font></td></tr><tr><td align=center height=18 class=web>&copy; 2009 Todd Url</td></tr></table></body></html>" % users.create_logout_url("/html/Support.html"))
            self.response.out.write(PAGE_HEADER_DESKTOP)
            self.response.out.write(STYLE_SHEET_DESKTOP)
            self.response.out.write(MAIN_MENU_DESKTOP)
            self.response.out.write("<table width=684 border=0 cellpadding=0 cellspacing=0 summary=content><tr valign=top>\n")
            self.response.out.write("<td class=\"grey2 greyj\" width=250>")
            self.response.out.write("<div style=\"margin: 15px 10px 15px 10px;\">\n")
            self.response.out.write("<font class=url>O</font><font class=odd>nline </font><font class=url>S</font><font class=odd>upport </font><font class=url>F</font><font class=odd>acility</font>")
            self.response.out.write("</div>\n")
            self.response.out.write("</td>\n")
            self.response.out.write("<td class=\"grey3 greyr\" width=432>")
            self.response.out.write("<div style=\"margin: 15px 20px 15px 20px;\">\n")
            self.response.out.write("<font class=odd>" + user.nickname() + "</font>")
            self.response.out.write("</div>\n")
            self.response.out.write("</td>\n")
            self.response.out.write("</tr>\n")
            self.response.out.write("<td class=\"grey2 greyj\" width=250>")
            self.response.out.write("<form action=/Staff method=get>\n")
            self.response.out.write("<button type=submit class=but5 onmouseover=\"this.style.color=\'#a9a9a9\'\" onmouseout=\"this.style.color=\'ffc000\'\">Main Menu</button><br>")
            self.response.out.write("</form>\n")
            self.response.out.write("<form action=/Staff method=post>\n")
            self.response.out.write("<button type=submit name=ID class=but5 onmouseover=\"this.style.color=\'#a9a9a9\'\" onmouseout=\"this.style.color=\'#ffc000\'\" value=UNDER CONSTRUCTION>UNDER CONSTRUCTION</button><br>")
            self.response.out.write("<button type=submit name=ID class=but5 onmouseover=\"this.style.color=\'#a9a9a9\'\" onmouseout=\"this.style.color=\'#ffc000\'\" value=UNDER CONSTRUCTION>UNDER CONSTRUCTION</button><br>")
            self.response.out.write("</form>\n")
            self.response.out.write("</td>\n")
            self.response.out.write("<td class=\"grey1 greyr\" width=432>")
            self.response.out.write("<div style=\"margin: 15px 20px 15px 20px;\">\n")
            self.response.out.write("</div>\n")
            self.response.out.write("</td>\n")
            self.response.out.write("</tr>\n")
            self.response.out.write("</table>\n")
            self.response.out.write(PAGE_FOOTER_DESKTOP)
	else:
	    memcache.set(key="cc", value=0)
            PAGE_FOOTER_DESKTOP = ("</td></tr><tr><td align=center class=\"copy bgcopy\" height=64><font class=orb><a href=\"%s\" class=link>Logout</a></font></td></tr><tr><td align=center height=18 class=web>&copy; 2009 Todd Url</td></tr></table></body></html>" % users.create_logout_url("/html/Support.html"))
            self.response.out.write(PAGE_HEADER_DESKTOP)
            self.response.out.write(STYLE_SHEET_DESKTOP)
            self.response.out.write(MAIN_MENU_DESKTOP)
            self.response.out.write("<table width=684 border=0 cellpadding=0 cellspacing=0 summary=content><tr valign=top>\n")
            self.response.out.write("<td class=\"grey2 greyj\" width=250>")
            self.response.out.write("<div style=\"margin: 15px 10px 15px 10px;\">\n")
            self.response.out.write("<font class=url>O</font><font class=odd>nline </font><font class=url>S</font><font class=odd>upport </font><font class=url>F</font><font class=odd>acility</font>")
            self.response.out.write("</div>\n")
            self.response.out.write("</td>\n")
            self.response.out.write("<td class=\"grey3 greyr\" width=432>")
            self.response.out.write("<div style=\"margin: 15px 20px 15px 20px;\">\n")
            self.response.out.write("<font class=odd>" + user.nickname() + "</font>")
            self.response.out.write("</div>\n")
            self.response.out.write("</td>\n")
            self.response.out.write("</tr>\n")
            self.response.out.write("<td class=\"grey2 greyj\" width=250>")
            self.response.out.write("<form action=/Staff method=post>\n")
            self.response.out.write("<button type=submit name=ID class=but5 onmouseover=\"this.style.color=\'#a9a9a9\'\" onmouseout=\"this.style.color=\'#ffc000\'\" value=Next_web_inquiry>Manage web inquiries</button><br>")
            self.response.out.write("<button type=submit name=ID class=but5 onmouseover=\"this.style.color=\'#a9a9a9\'\" onmouseout=\"this.style.color=\'#ffc000\'\" value=Manage_prospects>Manage prospects</button><br>")
            self.response.out.write("</form>\n")
            self.response.out.write("<form action=/TestHarness method=get>\n")
            self.response.out.write("<button type=submit name=ID class=but5 onmouseover=\"this.style.color=\'#a9a9a9\'\" onmouseout=\"this.style.color=\'#ffc000\'\" value=testharness>Test Utilities</button><br>")
            self.response.out.write("</form>\n")
    
            self.response.out.write("</td>\n")
            self.response.out.write("<td class=\"grey1 greyr\" width=432>")
            self.response.out.write("<div style=\"margin: 15px 20px 15px 20px;\">\n")
            self.response.out.write("</div>\n")
            self.response.out.write("</td>\n")
            self.response.out.write("</tr>\n")
            self.response.out.write("</table>\n")
            self.response.out.write(PAGE_FOOTER_DESKTOP)
  def post(self):
    user = users.get_current_user()
    selection = self.request.get('ID')
    PAGE_FOOTER_DESKTOP = ("</td></tr><tr><td align=center class=\"copy bgcopy\" height=64><font class=orb><a href=\"%s\" class=link>Logout</a></font></td></tr>\
    <tr><td align=center height=18 class=web>&copy; 2009 Todd Url</td></tr></table></body></html>" % users.create_logout_url("/html/Support.html"))
    self.response.out.write(PAGE_HEADER_DESKTOP)
    self.response.out.write(STYLE_SHEET_DESKTOP)
    self.response.out.write(MAIN_MENU_DESKTOP)
    self.response.out.write("<table width=684 border=0 cellpadding=0 cellspacing=0 summary=content><tr valign=top>\n")
    self.response.out.write("<td class=\"grey2 greyj\" width=250>")
    self.response.out.write("<div style=\"margin: 15px 10px 15px 10px;\">\n")
    self.response.out.write("<font class=url>O</font><font class=odd>nline </font><font class=url>S</font><font class=odd>upport </font><font ")
    self.response.out.write("class=url>F</font><font class=odd>acility</font>")
    self.response.out.write("</div>\n")
    self.response.out.write("</td>\n")
    self.response.out.write("<td class=\"grey3 greyr\" width=432>")
    self.response.out.write("<div style=\"margin: 15px 20px 15px 20px;\">\n")
    self.response.out.write("<font class=odd>" + user.nickname() + "</font>")
    self.response.out.write("</div>\n")
    self.response.out.write("</td>\n")
    self.response.out.write("</tr>\n")
    if selection == "Next_web_inquiry":
        self.response.out.write("<td valign=top class=\"grey2 greyj\" width=250>")
        self.response.out.write("<form action=/Staff method=get>\n")
        self.response.out.write("<button type=submit class=but5 onmouseover=\"this.style.color=\'#a9a9a9\'\" ")
	self.response.out.write("onmouseout=\"this.style.color=\'ffc000\'\">Main Menu</button><br>")
        self.response.out.write("</form>\n")
        self.response.out.write("<form action=/Staff method=post>\n")
        self.response.out.write("<button type=submit name=ID class=but5 onmouseover=\"this.style.color=\'#a9a9a9\'\" accesskey=\"39\" ")
	self.response.out.write("onmouseout=\"this.style.color=\'#ffc000\'\" value=Next_web_inquiry>Next web inquiry</button><br>")
        self.response.out.write("<button type=submit name=ID class=but5 onmouseover=\"this.style.color=\'#a9a9a9\'\" ")
	self.response.out.write("onmouseout=\"this.style.color=\'#ffc000\'\" value=Previous_web_inquiry>Previous web inquiry</button><br>")
        self.response.out.write("<button type=submit name=ID class=but5 onmouseover=\"this.style.color=\'#a9a9a9\'\" ")
	self.response.out.write("onmouseout=\"this.style.color=\'#ffc000\'\" value=Delete_web_inquiry>Delete web inquiry</button><br>")
        self.response.out.write("<button type=submit name=ID class=but5 onmouseover=\"this.style.color=\'#a9a9a9\'\" ")
	self.response.out.write("onmouseout=\"this.style.color=\'#ffc000\'\" value=Respond_to_web_inquiry>Respond to web inquiry</button><br>")
        self.response.out.write("<button type=submit name=ID class=but5 onmouseover=\"this.style.color=\'#a9a9a9\'\" ")
	self.response.out.write("onmouseout=\"this.style.color=\'#ffc000\'\" value=Convert_web_inquiry_to_prospect>Convert web inquiry to prospect</button><br>")
        self.response.out.write("</form>\n")
        self.response.out.write("</td>\n")
        self.response.out.write("<td class=\"grey1 greyj\" width=432>")
        self.response.out.write("<div style=\"margin: 0px 20px 0px 20px;\">\n")
        memcache.incr("cc")
        contacts = db.Query(Contact_Form)
        y = contacts.count()
	if y >= 1:
	    cur = memcache.get("cc")
	    if cur > y:
	        memcache.set(key="cc", value=1)
	        cur = memcache.get("cc")
            self.response.out.write("<table border=0>\n")
            self.response.out.write("<tr><td align=left class=greyt>REF<td align=left>%s</tr>" % contacts[cur - 1].REF)
            self.response.out.write("<tr><td align=left class=greyt>First<td align=left>%s</tr>" % contacts[cur - 1].First_Name)
            self.response.out.write("<tr><td align=left class=greyt>Last<td align=left>%s</tr>" % contacts[cur - 1].Last_Name)
            self.response.out.write("<tr><td align=left class=greyt>Email<td align=left>%s</tr>" % contacts[cur - 1].Email_Address)
            self.response.out.write("<tr><td align=left class=greyt>Phone<td align=left>%s</tr>" % contacts[cur - 1].Telephone)
            self.response.out.write("<tr><td align=left valign=top class=greyt>Message<td align=left valign=top>%s</tr>" % contacts[cur - 1].Message)
            self.response.out.write("</table>\n")
	else:
            self.response.out.write("<table border=0>\n")
            self.response.out.write("<tr><td align=left class=greyt>REF<td align=left>none</tr>")
            self.response.out.write("<tr><td align=left class=greyt>First<td align=left>none</tr>")
            self.response.out.write("<tr><td align=left class=greyt>Last<td align=left>none</tr>")
            self.response.out.write("<tr><td align=left class=greyt>Email<td align=left>none</tr>")
            self.response.out.write("<tr><td align=left class=greyt>Phone<td align=left>none</tr>")
            self.response.out.write("<tr><td align=left valign=top class=greyt>Message<td align=left>none</tr>")
            self.response.out.write("</table>\n")
        self.response.out.write("</div>\n")
        self.response.out.write("</td>\n")
        self.response.out.write("</tr>\n")
        self.response.out.write("</table>\n")
        self.response.out.write(PAGE_FOOTER_DESKTOP)
    if selection == "Previous_web_inquiry":
        self.response.out.write("<td valign=top class=\"grey2 greyj\" width=250>")
        self.response.out.write("<form action=/Staff method=get>\n")
        self.response.out.write("<button type=submit class=but5 onmouseover=\"this.style.color=\'#a9a9a9\'\" ")
	self.response.out.write("onmouseout=\"this.style.color=\'ffc000\'\">Main Menu</button><br>")
        self.response.out.write("</form>\n")
        self.response.out.write("<form action=/Staff method=post>\n")
        self.response.out.write("<button type=submit name=ID class=but5 onmouseover=\"this.style.color=\'#a9a9a9\'\" ")
	self.response.out.write("onmouseout=\"this.style.color=\'#ffc000\'\" value=Next_web_inquiry>Next web inquiry</button><br>")
        self.response.out.write("<button type=submit name=ID class=but5 onmouseover=\"this.style.color=\'#a9a9a9\'\" ")
	self.response.out.write("onmouseout=\"this.style.color=\'#ffc000\'\" value=Previous_web_inquiry>Previous web inquiry</button><br>")
        self.response.out.write("<button type=submit name=ID class=but5 onmouseover=\"this.style.color=\'#a9a9a9\'\" ")
	self.response.out.write("onmouseout=\"this.style.color=\'#ffc000\'\" value=Delete_web_inquiry>Delete web inquiry</button><br>")
        self.response.out.write("<button type=submit name=ID class=but5 onmouseover=\"this.style.color=\'#a9a9a9\'\" ")
	self.response.out.write("onmouseout=\"this.style.color=\'#ffc000\'\" value=Respond_to_web_inquiry>Respond to web inquiry</button><br>")
        self.response.out.write("<button type=submit name=ID class=but5 onmouseover=\"this.style.color=\'#a9a9a9\'\" ")
	self.response.out.write("onmouseout=\"this.style.color=\'#ffc000\'\" value=Convert_web_inquiry_to_prospect>Convert web inquiry to prospect</button><br>")
        self.response.out.write("</form>\n")
        self.response.out.write("</td>\n")
        self.response.out.write("<td class=\"grey1 greyj\" width=432>")
        self.response.out.write("<div style=\"margin: 0px 20px 0px 20px;\">\n")
	memcache.decr("cc")
        contacts = db.Query(Contact_Form)
        y = contacts.count()
	if y >= 1:
	    cur = memcache.get("cc")
	    if cur == 0:
	        memcache.set(key="cc", value=y)
	        cur = memcache.get("cc")
            self.response.out.write("<table border=0>\n")
            self.response.out.write("<tr><td align=left class=greyt>REF<td align=left>%s</tr>" % contacts[cur - 1].REF)
            self.response.out.write("<tr><td align=left class=greyt>First<td align=left>%s</tr>" % contacts[cur - 1].First_Name)
            self.response.out.write("<tr><td align=left class=greyt>Last<td align=left>%s</tr>" % contacts[cur - 1].Last_Name)
            self.response.out.write("<tr><td align=left class=greyt>Email<td align=left>%s</tr>" % contacts[cur - 1].Email_Address)
            self.response.out.write("<tr><td align=left class=greyt>Phone<td align=left>%s</tr>" % contacts[cur - 1].Telephone)
            self.response.out.write("<tr><td align=left valign=top class=greyt>Message<td align=left valign=top>%s</tr>" % contacts[cur - 1].Message)
            self.response.out.write("</table>\n")
	else:
            self.response.out.write("<table border=0>\n")
            self.response.out.write("<tr><td align=left class=greyt>REF<td align=left>none</tr>")
            self.response.out.write("<tr><td align=left class=greyt>First<td align=left>none</tr>")
            self.response.out.write("<tr><td align=left class=greyt>Last<td align=left>none</tr>")
            self.response.out.write("<tr><td align=left class=greyt>Email<td align=left>none</tr>")
            self.response.out.write("<tr><td align=left class=greyt>Phone<td align=left>none</tr>")
            self.response.out.write("<tr><td align=left valign=top class=greyt>Message<td align=left>none</tr>")
            self.response.out.write("</table>\n")
        self.response.out.write("</div>\n")
        self.response.out.write("</td>\n")
        self.response.out.write("</tr>\n")
        self.response.out.write("</table>\n")
        self.response.out.write(PAGE_FOOTER_DESKTOP)
    if selection == "Delete_web_inquiry":
        self.response.out.write("<td valign=top class=\"grey2 greyj\" width=250>")
        self.response.out.write("<form action=/Staff method=get>\n")
        self.response.out.write("<button type=submit class=but5 onmouseover=\"this.style.color=\'#a9a9a9\'\" ")
	self.response.out.write("onmouseout=\"this.style.color=\'ffc000\'\">Main Menu</button><br>")
        self.response.out.write("</form>\n")
        self.response.out.write("<form action=/Staff method=post>\n")
        self.response.out.write("<button type=submit name=ID class=but5 onmouseover=\"this.style.color=\'#a9a9a9\'\" ")
	self.response.out.write("onmouseout=\"this.style.color=\'#ffc000\'\" value=Next_web_inquiry>Next web inquiry</button><br>")
        self.response.out.write("<button type=submit name=ID class=but5 onmouseover=\"this.style.color=\'#a9a9a9\'\" ")
	self.response.out.write("onmouseout=\"this.style.color=\'#ffc000\'\" value=Previous_web_inquiry>Previous web inquiry</button><br>")
        self.response.out.write("<button type=submit name=ID class=but5 onmouseover=\"this.style.color=\'#a9a9a9\'\" ")
	self.response.out.write("onmouseout=\"this.style.color=\'#ffc000\'\" value=Delete_web_inquiry>Delete web inquiry</button><br>")
        self.response.out.write("<button type=submit name=ID class=but5 onmouseover=\"this.style.color=\'#a9a9a9\'\" ")
	self.response.out.write("onmouseout=\"this.style.color=\'#ffc000\'\" value=Respond_to_web_inquiry>Respond to web inquiry</button><br>")
        self.response.out.write("<button type=submit name=ID class=but5 onmouseover=\"this.style.color=\'#a9a9a9\'\" ")
	self.response.out.write("onmouseout=\"this.style.color=\'#ffc000\'\" value=Convert_web_inquiry_to_prospect>Convert web inquiry to prospect</button><br>")
        self.response.out.write("</form>\n")
        self.response.out.write("</td>\n")
        self.response.out.write("<td class=\"grey1 greyj\" width=432>")
        self.response.out.write("<div style=\"margin: 0px 20px 0px 20px;\">\n")
        contacts = db.Query(Contact_Form)
	cur = memcache.get("cc")
        db.delete(contacts[cur - 1])
        memcache.set(key="cc", value=1)
        contacts = db.Query(Contact_Form)
        y = contacts.count()
	if y >= 1:
	    cur = memcache.get("cc")
	    if cur > y:
	        memcache.set(key="cc", value=1)
	        cur = memcache.get("cc")
            self.response.out.write("<table border=0>\n")
            self.response.out.write("<tr><td align=left class=greyt>REF<td align=left>%s</tr>" % contacts[cur - 1].REF)
            self.response.out.write("<tr><td align=left class=greyt>First<td align=left>%s</tr>" % contacts[cur - 1].First_Name)
            self.response.out.write("<tr><td align=left class=greyt>Last<td align=left>%s</tr>" % contacts[cur - 1].Last_Name)
            self.response.out.write("<tr><td align=left class=greyt>Email<td align=left>%s</tr>" % contacts[cur - 1].Email_Address)
            self.response.out.write("<tr><td align=left class=greyt>Phone<td align=left>%s</tr>" % contacts[cur - 1].Telephone)
            self.response.out.write("<tr><td align=left valign=top class=greyt>Message<td align=left valign=top>%s</tr>" % contacts[cur - 1].Message)
            self.response.out.write("</table>\n")
	else:
            self.response.out.write("<table border=0>\n")
            self.response.out.write("<tr><td align=left class=greyt>REF<td align=left>none</tr>")
            self.response.out.write("<tr><td align=left class=greyt>First<td align=left>none</tr>")
            self.response.out.write("<tr><td align=left class=greyt>Last<td align=left>none</tr>")
            self.response.out.write("<tr><td align=left class=greyt>Email<td align=left>none</tr>")
            self.response.out.write("<tr><td align=left class=greyt>Phone<td align=left>none</tr>")
            self.response.out.write("<tr><td align=left valign=top class=greyt>Message<td align=left>none</tr>")
            self.response.out.write("</table>\n")
        self.response.out.write("</div>\n")
        self.response.out.write("</td>\n")
        self.response.out.write("</tr>\n")
        self.response.out.write("</table>\n")
        self.response.out.write(PAGE_FOOTER_DESKTOP)

    if selection == "Respond_to_web_inquiry":
        contacts = db.Query(Contact_Form)
	cur = memcache.get("cc")
        self.response.out.write("<td valign=top class=\"grey2 greyj\" width=250>")
        self.response.out.write("<form action=/Staff method=get>\n")
        self.response.out.write("<button type=submit class=but5 onmouseover=\"this.style.color=\'#a9a9a9\'\" ")
	self.response.out.write("onmouseout=\"this.style.color=\'ffc000\'\">Main Menu</button><br>")
        self.response.out.write("</form>\n")
        self.response.out.write("<form action=/Staff method=post>\n")
        self.response.out.write("<button type=submit name=ID class=but5 onmouseover=\"this.style.color=\'#a9a9a9\'\" ")
	self.response.out.write("onmouseout=\"this.style.color=\'#ffc000\'\" value=Next_web_inquiry>Next web inquiry</button><br>")
        self.response.out.write("<button type=submit name=ID class=but5 onmouseover=\"this.style.color=\'#a9a9a9\'\" ")
	self.response.out.write("onmouseout=\"this.style.color=\'#ffc000\'\" value=Previous_web_inquiry>Previous web inquiry</button><br>")
        self.response.out.write("<button type=submit name=ID class=but5 onmouseover=\"this.style.color=\'#a9a9a9\'\" ")
	self.response.out.write("onmouseout=\"this.style.color=\'#ffc000\'\" value=Delete_web_inquiry>Delete web inquiry</button><br>")
        self.response.out.write("<button type=submit name=ID class=but5 onmouseover=\"this.style.color=\'#a9a9a9\'\" ")
	self.response.out.write("onmouseout=\"this.style.color=\'#ffc000\'\" value=Send_response_to_web_inquiry>Send response to web inquiry</button><br>")
        self.response.out.write("<button type=submit name=ID class=but5 onmouseover=\"this.style.color=\'#a9a9a9\'\" ")
	self.response.out.write("onmouseout=\"this.style.color=\'#ffc000\'\" value=Convert_web_inquiry_to_prospect>Convert web inquiry to prospect</button><br>")
        self.response.out.write("</td>\n")
        self.response.out.write("<td align=right class=\"grey1 greyj\" width=432>")
        self.response.out.write("<div style=\"margin: 0px 20px 0px 20px;\">\n")
        self.response.out.write("<table border=0 cellpadding=0 cellspacing=0 summary=content>\n")
        self.response.out.write("<tr><td align=left class=greyt width=55 >To</td><td><input type=text name=From class=inputb value=\"%s %s <%s>\"></td></tr>\n" % (contacts[cur - 1].First_Name, contacts[cur - 1].Last_Name, contacts[cur - 1].Email_Address))
        self.response.out.write("<tr><td align=left class=greyt>From</td><td><input type=text name=From class=inputb value=\"%s\"></td></tr>\n" % user.email())
        self.response.out.write("<tr valign=top><td align=left class=greyt>Message</td><td><textarea name=Message class=txtas>\"%s\"</textarea></td></tr>\n" % contacts[cur - 1].Message)
        self.response.out.write("</table>\n")
        self.response.out.write("</form></div></td>\n")
        self.response.out.write("</div>\n")
        self.response.out.write("</td>\n")
        self.response.out.write("</tr>\n")
        self.response.out.write("</table>\n")
        self.response.out.write(PAGE_FOOTER_DESKTOP)

#############################################################################################
#Contact PAGE gives web users a method of filling out a contact form for the contact database
#############################################################################################
class contact(webapp.RequestHandler):
  def get(self):
    global PAGE_HEADER_DESKTOP
    PAGE_HEADER_DESKTOP = PAGE_HEADER_DESKTOP.replace("URL IS/IT", "URL IS/IT - Contact")
    #######################################################
    #contact PAGE_DESKTOP Generic page for DESKTOP browsers
    #######################################################
    PAGE_DESKTOP = "\
    <table width=684 border=0 cellpadding=0 cellspacing=0 summary=content><tr valign=top>\
    <td class=\"grey2 greyj\" width=342><div class=mdig>\
    <font class=odd>Contact </font><font class=url>Information</font><br /><br />\
    \nTodd Url<br />13370 SW Watkins Avenue<br />Tigard OR  97223<br />\
    <br />\
    <table border=0 cellpadding=0 cellspacing=0 summary=content width=280>\
    <tr>\
    <td width=60>Tel.:</td>\
    <td width=220><a class=link href=callto://+19094863875>+01 909 486 3875</a></td>\
    </tr>\
    <tr>\
    <td width=60>FAX:</td>\
    <td width=220>+01 909 486 3875</td>\
    </tr>\
    <tr>\
    <td width=60>E-mail:</td>\
    <td width=220><a href=mailto:toddurl@gmail.com class=link>toddurl@gmail.com</a></td>\
    </tr>\
    </table>\
    </div></td>\
    <td rowspan=2 class=\"grey3 greyj\" width=342><div class=msmall0>\
    <font class=odd>Contact </font><font class=url>Form</font><br /><br />\
    <font class=orb>Google&#153 information technology evolves rapidly,</font> and we strive to keep the our site as up to date and accurate as possible.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.<br /><br >If you would like to be contacted with information regarding our technical staffing services or products, please provide us with your contact information and a brief description of your interests, call +1 909 486-3875 and ask for Todd Url.<br >Thank you.\
    <br />\
    <form name=contact method=post action=Contact_Response id=contact>\
    <table border=0 cellpadding=0 cellspacing=6 summary=content>\
    <tr><td align=right class=greyn>First Name:</td><td><input type=text name=First_Name class=inputc></td></tr>\
    <tr><td align=right class=greyn>Last Name:</td><td><input type=text name=Last_Name class=inputc></td></tr>\
    <tr><td align=right class=greyn>Email Address:</td><td><input type=text name=Email_Address class=inputc></td></tr>\
    <tr><td align=right class=greyn>Telephone:</td><td><input type=text name=Telephone class=inputc></td></tr>\
    <tr valign=top><td align=right class=greyn>Message:</td><td><textarea name=Message class=txtar></textarea></td></tr>\
    <tr><td></td><td align=right><input type=\"reset\" name=\"reset\" value=\"\" class=\"but1\"><input type=\"submit\" name=\"submit\" value=\"\" class=\"but2\"></td></tr>\
    </table>\
    </form></div></td>\
    </tr>\
    <tr><td valign=top class=grey1><div class=msmall0>\
    <font class=odd>Our </font><font class=url>Locations</font><br /><br />\
    <font class=orb>United States of America</font><br />\
    <br />\
    124 Blossom Hill Road H-504<br />San Jose CA  95124<br />\
    <br />\
    13370 SW Watkins Avenue<br />Tigard OR  97223<br />\
    <br />\
    <font class=orb>Philippines</font><br />\
    <br />\
    411-A  Flores Street<br />Ermita, Metro Manila 1000<br />\
    <br />\
    <div class=dline></div>\
    </div></td></tr>\
    </table>"
    ####################################################################
    #contact PAGE_MOBILE_LOW_END Generic page for low-end mobile devices
    ####################################################################
    PAGE_MOBILE_LOW_END = "\
    <div class=grey2>\
    <font class=odd>Contact </font><font class=url>Information</font>\
    </div>\
    <font class=norm>\
    <div class=grey2>\
    Todd Url\
    </div>\
    <div class=grey2>\
    13370 SW Watkins Avenue\
    </div>\
    <div class=grey2>\
    Tigard OR  97223\
    </div>\
    <div class=grey2>\
    Tel.:\
    </div>\
    <div class=grey2>\
    <a class=link href=callto://+19094863875>+01 909 486 3875</a>\
    </div>\
    <div class=grey2>\
    FAX:\
    </div>\
    <div class=grey2>\
    +01 909 486 3875\
    </div>\
    <div class=grey2>\
    E-mail:\
    </div>\
    <div class=grey2>\
    <a href=mailto:toddurl@gmail.com class=link>toddurl@gmail.com</a>\
    </div>\
    <div class=grey3>\
    <font class=odd>Contact </font><font class=url>Form</font>\
    </div>\
    <div class=grey3>\
    <font class=orb>\
    Google&#153 information technology evolves rapidly,\
    </font> \
    and we strive to keep the our site as up to date and accurate as possible. \
    If you find an error or have a suggestion for improving our content, we would \
    appreciate your feedback. If you would like to be contacted with information \
    regarding our technical staffing services or products, please provide us with \
    your contact information and a brief description of your interests, \
    call +1 909 486-3875 and ask for Todd Url.\
    </div>\
    <div class=grey3>\
    Thank you.\
    </div>\
    <div class=grey3>\
    <form name=contact method=post action=Contact_Response id=contact>\
    First Name:\
    </div>\
    <div class=grey3>\
    <input type=text name=First_Name class=inputc>\
    </div>\
    <div class=grey3>\
    Last Name:\
    </div>\
    <div class=grey3>\
    <input type=text name=Last_Name class=inputc>\
    </div>\
    <div class=grey3>\
    Email Address:\
    </div>\
    <div class=grey3>\
    <input type=text name=Email_Address class=inputc>\
    </div>\
    <div class=grey3>\
    Telephone:\
    </div>\
    <div class=grey3>\
    <input type=text name=Telephone class=inputc>\
    </div>\
    <div class=grey3>\
    Message:\
    </div>\
    <div class=grey3>\
    <textarea name=Message class=txtar></textarea>\
    </div>\
    <div class=grey3>\
    <input type=\"reset\" name=\"reset\" value=\"\" class=\"but1\">\
    <input type=\"submit\" name=\"submit\" value=\"\" class=\"but2\">\
    </form>\
    </div>\
    <div class=grey1>\
    <font class=odd>Our </font><font class=url>Locations</font>\
    </div>\
    <div class=grey1>\
    <font class=orb>\
    United States of America\
    </font>\
    </div>\
    <div class=grey1>\
    124 Blossom Hill Road H-504<br />San Jose CA  95124\
    </div>\
    <div class=grey1>\
    13370 SW Watkins Avenue\
    </div>\
    <div class=grey1>\
    Tigard OR  97223\
    </div>\
    <div class=grey1>\
    <font class=orb>Philippines</font>\
    </div>\
    <div class=grey1>\
    411-A  Flores Street\
    </div>\
    <div class=grey1>\
    Ermita, Metro Manila 1000\
    </div>\
    </font>"
    global DEVICE
    detectDevice()
    if DEVICE == "DESKTOP":
      self.response.out.write(PAGE_HEADER_DESKTOP)
      self.response.out.write(STYLE_SHEET_DESKTOP)
      self.response.out.write(MAIN_MENU_DESKTOP)
      self.response.out.write(PAGE_DESKTOP)
      self.response.out.write(PAGE_FOOTER_DESKTOP)
    if DEVICE == "MOBILE_LOW_END":
      self.response.out.write(PAGE_HEADER_MOBILE_LOW_END)
      self.response.out.write(STYLE_SHEET_MOBILE_LOW_END)
      self.response.out.write(MAIN_MENU_MOBILE_LOW_END)
      self.response.out.write(PAGE_MOBILE_LOW_END)
      self.response.out.write(PAGE_FOOTER_MOBILE_LOW_END)

############################################################################################################
#contact_response receives the POST from contact, updates the contact database and generates a response page
############################################################################################################
class contact_response(webapp.RequestHandler):
  def post(self):
    ###################################################################
    #Populate the contact table with the information in the POSTed form
    ###################################################################
    contact = Contact_Form()
    contact.First_Name     = self.request.get('First_Name')
    contact.Last_Name      = self.request.get('Last_Name')
    contact.Email_Address  = self.request.get('Email_Address')
    contact.Telephone      = self.request.get('Telephone')
    contact.Message        = self.request.get('Message')
    contact.put()
    ################################################################
    #contact_response PAGE_DESKTOP Generic page for DESKTOP browsers
    ################################################################
    PAGE_DESKTOP = "\
    <table width=684 border=0 cellpadding=0 cellspacing=0 summary=content><tr valign=top>\
    <td class=\"grey2 greyj\" width=342><div class=mdig>\
    <font class=odd>Contact </font><font class=url>Information</font><br /><br />\
    \nTodd Url<br />13370 SW Watkins Avenue<br />Tigard OR  97223<br />\
    <br />\
    <table border=0 cellpadding=0 cellspacing=0 summary=content width=280>\
    <tr>\
    <td width=60>Tel.:</td>\
    <td width=220><a class=link href=callto://+19094863875>+01 909 486 3875</a></td>\
    </tr>\
    <tr>\
    <td width=60>FAX:</td>\
    <td width=220>+01 909 486 3875</td>\
    </tr>\
    <tr>\
    <td width=60>E-mail:</td>\
    <td width=220><a href=mailto:toddurl@gmail.com class=link>toddurl@gmail.com</a></td>\
    </tr>\
    </table>\
    </div></td>\
    <td rowspan=2 class=\"grey3 greyj\" width=342><div class=msmall0>\
    <font class=odd>Contact </font><font class=url>Form</font><br /><br />\
    <font class=orb>\
    URL IS/IT values your input and we're comited\
    </font> \
    to acting upon it in an expedient manner. The following reference has been assigned and routed to \
    an appropriate staff member for further action.  Thank you for REF# \
    <font class=orb>" + \
    str(contact.REF) + "\
    </font>.\
    <br /><br >\
    If you would like to be contacted with information regarding our technical staffing services or \
    products, please provide us with your contact information and a brief description of your intrests, \
    call +1 909 486-3875 and ask for Todd Url.<br >Thank you.\
    <form name=contact method=post action=Contact_Response id=contact>\
    <table border=0 cellpadding=0 cellspacing=6 summary=content>\
    <tr><td align=right class=greyn>First Name:</td><td><input type=text name=First_Name class=inputc></td></tr>\
    <tr><td align=right class=greyn>Last Name:</td><td><input type=text name=Last_Name class=inputc></td></tr>\
    <tr><td align=right class=greyn>Email Address:</td><td><input type=text name=Email_Address class=inputc></td></tr>\
    <tr><td align=right class=greyn>Telephone:</td><td><input type=text name=Telephone class=inputc></td></tr>\
    <tr valign=top><td align=right class=greyn>Message:</td><td><textarea name=Message class=txtar></textarea></td></tr>\
    <tr><td></td><td align=right><input type=\"reset\" name=\"reset\" value=\"\" class=\"but1\"><input type=\"submit\" name=\"submit\" value=\"\" class=\"but2\"></td></tr>\
    </table>\
    </form></div></td>\
    </tr>\
    <tr><td valign=top class=grey1><div class=msmall0>\
    <font class=odd>Our </font><font class=url>Locations</font><br /><br />\
    <font class=orb>United States of America</font><br />\
    <br />\
    124 Blossom Hill Road H-504<br />San Jose CA  95124<br />\
    <br />\
    13370 SW Watkins Avenue<br />Tigard OR  97223<br />\
    <br />\
    <font class=orb>Philippines</font><br />\
    <br />\
    411-A  Flores Street<br />Ermita, Metro Manila 1000<br />\
    <br />\
    <div class=dline></div>\
    </div></td></tr>\
    </table>"
    #############################################################################
    #contact_response PAGE_MOBILE_LOW_END Generic page for low-end mobile devices
    #############################################################################
    PAGE_MOBILE_LOW_END = "\
    <div class=grey2>\
    <font class=odd>Contact </font><font class=url>Information</font>\
    </div>\
    <font class=norm>\
    <div class=grey2>\
    Todd Url\
    </div>\
    <div class=grey2>\
    13370 SW Watkins Avenue\
    </div>\
    <div class=grey2>\
    Tigard OR  97223\
    </div>\
    <div class=grey2>\
    Tel.:\
    </div>\
    <div class=grey2>\
    <a class=link href=callto://+19094863875>+01 909 486 3875</a>\
    </div>\
    <div class=grey2>\
    FAX:\
    </div>\
    <div class=grey2>\
    +01 909 486 3875\
    </div>\
    <div class=grey2>\
    E-mail:\
    </div>\
    <div class=grey2>\
    <a href=mailto:toddurl@gmail.com class=link>toddurl@gmail.com</a>\
    </div>\
    <div class=grey3>\
    <font class=odd>Contact </font><font class=url>Form</font>\
    </div>\
    <div class=grey3>\
    <font class=orb>\
    URL IS/IT values your input and we're comited\
    </font> \
    to acting upon it in an expedient manner. The following reference has been assigned and routed to \
    an appropriate staff member for further action.  Thank you for REF# \
    <font class=orb>" + \
    str(contact.REF) + "\
    </font>.\
    </div>\
    <div class=grey3>\
    </div>\
    <div class=grey3>\
    If you would like to be contacted with information regarding our technical staffing services or \
    products, please provide us with your contact information and a brief description of your intrests, \
    call +1 909 486-3875 and ask for Todd Url.\
    </div>\
    <div class=grey3>\
    Thank you.\
    </div>\
    <div class=grey3>\
    Thank you.\
    </div>\
    <div class=grey3>\
    <form name=contact method=post action=Contact_Response id=contact>\
    First Name:\
    </div>\
    <div class=grey3>\
    <input type=text name=First_Name class=inputc>\
    </div>\
    <div class=grey3>\
    Last Name:\
    </div>\
    <div class=grey3>\
    <input type=text name=Last_Name class=inputc>\
    </div>\
    <div class=grey3>\
    Email Address:\
    </div>\
    <div class=grey3>\
    <input type=text name=Email_Address class=inputc>\
    </div>\
    <div class=grey3>\
    Telephone:\
    </div>\
    <div class=grey3>\
    <input type=text name=Telephone class=inputc>\
    </div>\
    <div class=grey3>\
    Message:\
    </div>\
    <div class=grey3>\
    <textarea name=Message class=txtar></textarea>\
    </div>\
    <div class=grey3>\
    <input type=\"reset\" name=\"reset\" value=\"\" class=\"but1\">\
    <input type=\"submit\" name=\"submit\" value=\"\" class=\"but2\">\
    </form>\
    </div>\
    <div class=grey1>\
    <font class=odd>Our </font><font class=url>Locations</font>\
    </div>\
    <div class=grey1>\
    <font class=orb>\
    United States of America\
    </font>\
    </div>\
    <div class=grey1>\
    124 Blossom Hill Road H-504<br />San Jose CA  95124\
    </div>\
    <div class=grey1>\
    13370 SW Watkins Avenue\
    </div>\
    <div class=grey1>\
    Tigard OR  97223\
    </div>\
    <div class=grey1>\
    <font class=orb>Philippines</font>\
    </div>\
    <div class=grey1>\
    411-A  Flores Street\
    </div>\
    <div class=grey1>\
    Ermita, Metro Manila 1000\
    </div>\
    </font>"
    global DEVICE
    detectDevice()
    if DEVICE == "DESKTOP":
      self.response.out.write(PAGE_HEADER_DESKTOP)
      self.response.out.write(STYLE_SHEET_DESKTOP)
      self.response.out.write(MAIN_MENU_DESKTOP)
      self.response.out.write(PAGE_DESKTOP)
      self.response.out.write(PAGE_FOOTER_DESKTOP)
    if DEVICE == "MOBILE_LOW_END":
      self.response.out.write(PAGE_HEADER_MOBILE_LOW_END)
      self.response.out.write(STYLE_SHEET_MOBILE_LOW_END)
      self.response.out.write(MAIN_MENU_MOBILE_LOW_END)
      self.response.out.write(PAGE_MOBILE_LOW_END)
      self.response.out.write(PAGE_FOOTER_MOBILE_LOW_END)

#######################################################################################
#urlescope is a JavaScript YouTube player designed to mimic a television remote control
#######################################################################################
class urlescope(webapp.RequestHandler):
  def get(self):
    ########################################################
    #Load the datastore with default values for a new viewer
    ########################################################
    scope                 = URLeScope()
    scope.uvPWR           = "false"
    scope.uvVewing        = "false"
    scope.dispInfo        = "false"
    scope.currChannel     = 0
    scope.prevChannel     = 0
    scope.favChannel      = 3
    scope.progScope       = 0
    scope.uv0seq          = 0
    scope.uv0name         = "<i>The Photo-Drama of Creation</i>"
    scope.uv0desc         = "A religious film produced under the direction of <a class=link target=_blank \
                             href=http://en.wikipedia.org/wiki/Charles_Taze_Russell>Charles Taze Russell</a>, the founder of the \
                             Bible Student movement. Production was completed Drama was completed in 1914. It has the distinction \
                             of being the first major screenplay to incorporate synchronized sound, moving film, and color slides."
    scope.uv0             = ['a7cF0nw5S-g','HwdiZ27PqNs','xLKIKh7hjoc','i8UXC_GNZRs','A3St39wp4dY','ElKjeiGO-Sw','dzqWTdDaseA',\
                             '0DNdO8og-f4','BF-wtKLJ92w','fWZrBTd7IXY','4AHZ1tabRK8','tNItrj7cphg','w5RLikpbKDY','t_XbWHOFLto',\
                             'SdOjszWOPEM','R1ATRO7SUIA','m7fbWz_fOqc','Ye_qtJZQS98','K5k_yTXWkXk','ifcT2g-zvg8','iOoOpPza1KI',\
                             'G9QLXPyKSyc','kmgJGq_lDVw','PrD4V69ssyI','XDUKGaq5XzQ','BWYEGR5gA1A','X_F2t425BWE','OMJ8jKP2Ans',\
                             'tVDIJRLTDz8','Qr_T3ASSeT0']
    scope.uv0info         = ['Intro. to Part I','Part 1 of 96','Part   2 of 96','Part   3 of 96','Part   4 of 96','Part   5 of 96',\
                             'Part   6 of 96','Part   7 of 96','Part   8 of 96','Part   9 of 96','Part  10 of 96','Part  11 of 96',\
                             'Part  12 of 96','Part  13 of 96','Part  14 of 96','Part  15 of 96','Part  16 of 96','Part  17 of 96',\
                             'Part  18 of 96','Part  19 of 96','Part  20 of 96','Part  21 of 96','Part  22 of 96','Part  23 of 96',\
                             'Part  24 of 96','Part  25 of 96','Part  26 of 96','Part  27 of 96','Part  28 of 96','Part  29 of 96',]
    scope.uv1seq          = 0
    scope.uv1name         = "Flying Boats"
    scope.uv1desc         = "One of the finest collection of aviation videos on the web, bomberguy specializes in news reel footage of vintage \
                             aircraft. My favorite are the flying boats. What&#39s your&#39s?"
    scope.uv1             = ['R4EgOj0WKRA','eo8VxPC6JlI','SOrj2cSDO-M','z3ZoXdqZLJ8','qKJQtnUulDo','fqbTgsE-DuY','Wy86aHpOdkg','PmuNQXst6nI',\
                             'fF3K9DEvvts','YkXCGn8-Np8','AV1eUeo27tc','dIVW-1ATuiw','eXQaKDs6OUs','hSm0nq9qbKA','7h1beFHjHno','dNqHENNmChU',\
                             'bYtazEBQ1K8','qxUncWwSTYs','6pl1aMVnZyY','iruRnuM373Y','ZDG5SFJ337A','EMu4Cw_yBRI']
    scope.uv1info         = ['Be-200 MULTIPURPOSE AMPHIBIOUS AIRCRAFT','Mars Flying Boats','Convair F2Y Sea Dart','Dornier Superwal 1926',\
                             'Latcore 521 Lieutenant de Vaisseau Paris','Sikorsky S-40 Flying Boat','Short S.40 Shetland II Flying Boat',\
                             'Short S.17 Kent Flying Boat','Beriev A 40 Albatross','Blriot 5190 Flying Boat','Saunders-Roe Princess Flying Boat',\
                             'Sukhoi Be-103','Beardmore Inverness flying boat','Blackburn Iris Flying Boat','A flight aboard the DoX - 1930',\
                             'Consolidated PBY Catalina with the RAF','The Short Mayo Composite','Saunders Roe SR A-1',\
                             'Sanders Roe SR A/1 and Convair Sea Dart','Canadair CL-415 By Simone DAscenzi','Russian Be-12',\
                             'Beriev Be-10']
    scope.uv2seq          = 0
    scope.uv2name         = "Seth MacFarlane&#39s <a class=link tatget=_blank \
                             href=http://en.wikipedia.org/wiki/Seth_MacFarlane%27s_Cavalcade_of_Cartoon_Comedy>\
                             Cavalcade of Cartoon Comedy</a>"
    scope.uv2desc         = "An American animated cartoon web series created by Seth MacFarlane."
    scope.uv2             = ['ghZ_dkxOwEY','o_kbOQIg4sM','WSQvc6VWrPY','as5KLmbLUjI']
    scope.uv2info         = ['Super Mario Rescues The Princess','A Dog on The $25,000 Pyramid',\
                             'Why Bob Marley Should Not Have Acted as His Own Attorney','Adopted']
    scope.uv3seq          = 0
    scope.uv3name         = "Music URLeVision"
    scope.uv3desc         = "Web 2.5 version of the classic TV network."
    scope.uv3             = ['_f2YeGu6Xqw','bU1514VkDkc','envYjehnvLg','jhPAK8HjcPI','vjMGtb3MDWo','VPkcwBVhi-8']
    scope.uv3info         = ['<a target=_blank class=link href=http://www.reverbnation.com/rickcastro>Rick Castro</a> - Mr. Tinker Man',\
                             'Miley Cyrus - 7 Things','Rihanna - Live Unfaithful',\
                             'Alicia Keys - If I Aint Got You','LeAnn Rimes - Can&#39t Fight The Moonlight',\
                             'Taylor Swift HD &#39LOVE STORY&#39 GREATEST LIVE PERFORMANCE EVER!']
    scope.uv4seq          = 0
    scope.uv4name         = "Classic Commercials"
    scope.uv4desc         = "Thank goodness we don&#39t have to watch these anymore."
    scope.uv4             = ['OYecfV3ubP8','mSHo3j72fIo']
    scope.uv4info         = ['OYecfV3ubP8','mSHo3j72fIo']
    scope.uv5seq          = 0
    scope.uv5name         = "FOX News, fair and balanced"
    scope.uv5desc         = "Right wing retoric from FOX."
    scope.uv5             = ['ouKJixL--ms','CWHq6v2tfP0','1SiVasR2Gzo','dN823dUu6KA','MWZHTJsR4Bc','LcPF59CoGvs','nLkQeuU1LmM']
    scope.uv5info         = ['ouKJixL--ms','CWHq6v2tfP0','1SiVasR2Gzo','dN823dUu6KA','MWZHTJsR4Bc','LcPF59CoGvs','nLkQeuU1LmM']
    scope.uv6seq          = 0
    scope.uv6name         = "Google Developers"
    scope.uv6desc         = "The best of Google APIs"
    scope.uv6             = ['xZwH_2MVmKI','u1zgFlCw8Aw','usxO-nLyO0M']
    scope.uv6info         = ['xZwH_2MVmKI','u1zgFlCw8Aw','usxO-nLyO0M']
    scope.uv7seq          = 0
    scope.uv7name         = "The Squirrel Channel"
    scope.uv7desc         = "Gotta love the little tree rats."
    scope.uv7             = ['ZGhZHlpSE6k','cd5Hvghe58k','TamMqvk4Bb8','GcfWD62sbcs','8cCFn55Zxkc','ADuSnt6PFn8']
    scope.uv7info         = ['ZGhZHlpSE6k','cd5Hvghe58k','TamMqvk4Bb8','GcfWD62sbcs','8cCFn55Zxkc','ADuSnt6PFn8']
    scope.uv8seq          = 0
    scope.uv8name         = "Movie Trailers"
    scope.uv8desc         = "New movies comming to a theatre near you."
    scope.uv8             = ['d1_JBMrrYw8','Wo85qZm-Zuk','KsGuzZqVeQU','LjMkNrX60mA','nQ6MDCUfxvY','ZPieOzIA7NM','LjMkNrX60mA']
    scope.uv8info         = ['<a class=link target=_blank href=http://www.avatarmovie.com>Avatar</a> Director: James Cameron Release: 12/18/2009 Aparaplegic war veteran is brought to the planet Pandora which is inhabited by the Navi. The Navi is a humanoid race with their own language and culture, but the people of Earth find themselves at odds with the Navi.','Wo85qZm-Zuk','KsGuzZqVeQU','LjMkNrX60mA','nQ6MDCUfxvY','ZPieOzIA7NM','LjMkNrX60mA']
    scope.uv9seq          = 0
    scope.uv9name         = "Jehovah&#39s Witnesses, fair and balanced"
    scope.uv9desc         = "Jehovah&#39s Witnesses is a restorationist, millenarian Christian denomination. They are directed by the Governing \
                             Body, a group  of elders which exercises authority on all doctrinal matters, based on their interpretation of \
                             the Bible, with preference given to their own translation, the New World Translation of the Holy Scriptures."
    scope.uv9             = ['Dt47lPS_QEw','k0lyLjI5X_o','Jk441bKj-7k','6c6I0fjiYNU','xUmp18CeQE8','pf8za39Aa-g','PEPtLJurxy0',\
                             'C7U4i8LnOow','ZlHbz5G4UTM','9uP7UftOMTI','KEup8CVDmPQ','EB2aljuY_-M','kjtBq5mG_Wg','C7U4i8LnOow']
    scope.uv9info         = ['Dt47lPS_QEw','k0lyLjI5X_o','Jk441bKj-7k','6c6I0fjiYNU','xUmp18CeQE8','pf8za39Aa-g','PEPtLJurxy0',\
                             'C7U4i8LnOow','ZlHbz5G4UTM','9uP7UftOMTI','KEup8CVDmPQ','EB2aljuY_-M','kjtBq5mG_Wg','C7U4i8LnOow']
    scope.put()
    ####################################################################################
    #URLESCOPE JavaScript object containing the YouTube player and URLeVision client API
    ####################################################################################
    YOUTUBE_MAIN_MENU_DESKTOP = MAIN_MENU_DESKTOP.replace("AC.gif", "urlevision.gif")
    URLESCOPE = "\
    <link rel=\"stylesheet\" type=\"text/css\" href=\"css/style.css\" />\n\
    <!--[if lt IE 7]>\n\
     <link rel=\"stylesheet\" href=\"css/ie6.css\" />\n\
    <![endif]-->\n\
    <script src=\"http://www.google.com/jsapi\"></script>\n\
    <script>\n\
    google.load(\"swfobject\", \"2.2\");\n\
    </script>\n\
    <script>\n\
    var vol                 = 50;\n\
    var currDepth           = 0;\n\
    var dispInfo            = " + scope.dispInfo + ";\n\
    var uvPWR               = " + scope.uvPWR + ";\n\
    var progScope           = \"" + str(scope.progScope)   + "\";\n\
    var currChannel         = \"" + str(scope.currChannel) + "\";\n\
    var prevChannel         = \"" + str(scope.prevChannel) + "\";\n\
    var favChannel          = \"" + str(scope.favChannel)  + "\";\n\
    var channelProgram      = false;\n\
    var programFav          = false;\n\
    var channelChange       = new URLsignal('URLeVision');\n\
    var positionChange      = new URLsignal('URLeVision');\n\
    var programChange       = new URLsignal('URLeVision');\n\
    var channelState        = new URLsignal('URLeVision');\n\
    var channelInformation  = new URLsignal('URLeVision');\n\
    channelChange.callback  = function(responseText, responseStatus, responseXML) {\n\
      eval(responseText);\n\
      if (dispInfo) {\n\
        ytplayer.loadVideoById(c.S, 0);\n\
        document.getElementById(\"uv\" + c.P).style.backgroundColor=\"#000000\";\n\
        document.getElementById(\"uv\" + c.C).style.backgroundColor=\"#ff0000\";\n\
        document.getElementById(\"AO\").innerHTML=\"<div class=mstd><font class=gurl>Information:</font><br />\
        <font class=orb>Channel Name:</font><br /><font class=norm>\" + c.N + \"</font><br />\
        <font class=orb>Channel Description:</font><br /><font class=norm>\" + c.D + \"</font><br />\
        <font class=orb>Now Playing:</font><br /><font class=norm>\" + c.I + \"</font></div>\";\n\
      } else {\n\
        ytplayer.loadVideoById(c.S, 0);\n\
        document.getElementById(\"uv\" + c.P).style.backgroundColor=\"#000000\";\n\
        document.getElementById(\"uv\" + c.C).style.backgroundColor=\"#ff0000\";\n\
      }\n\
    }\n\
    positionChange.callback = function(responseText, responseStatus, responseXML) {\n\
      eval(responseText);\n\
      if (dispInfo) {\n\
        ytplayer.loadVideoById(s.S, 0);\n\
        document.getElementById(\"AO\").innerHTML=\"<div class=mstd><font class=gurl>Channel Information:</font><br />\
        <font class=orb>Channel Name:</font><br /><font class=norm>\" + s.N + \"</font><br /><font class=orb>Channel Description:</font><br />\
        <font class=norm>\" + s.D + \"</font><br /><font class=orb>Now Playing:</font><br /><font class=norm>\" + s.I + \"</font></div>\";\n\
      } else {\n\
        ytplayer.loadVideoById(s.S, 0);\n\
      }\n\
    }\n\
    programChange.callback = function(responseText, responseStatus, responseXML) {\n\
      eval(responseText);\n\
      var menu = \"\";\n\
      var i = 0;\n\
      while (i <= p.l) {\n\
        if (i == currDepth) {\n\
          menu = menu + \"<div class=\\\"mstdb grey4\\\"><font color=#ffc000>\" + p.m[i++] + \"</font></div>\";\n\
        } else {\n\
          menu = menu + \"<div class=\\\"mstdb grey6\\\">\" + p.m[i++] + \"</div>\";\n\
        }\n\
      }\n\
      document.getElementById(\"AS\").innerHTML=menu;\n\
    }\n\
    channelInformation.callback = function(responseText, responseStatus, responseXML) {\n\
      eval(responseText);\n\
      document.getElementById(\"AO\").innerHTML=\"<div class=mstd><font class=gurl>Channel Information:</font><br />\
      <font class=orb>Channel Name:</font><br /><font class=norm>\" + i.N + \"</font><br /><font class=orb>Channel Description:</font><br />\
      <font class=norm>\" + i.D + \"</font><br /><font class=orb>Now Playing:</font><br /><font class=norm>\" + i.I + \"</font></div>\";\n\
    }\n\
    function URLsignal(url, callbackFunction) {\n\
      var that=this;      \n\
      this.signaling = false;\n\
      this.abort = function() {\n\
        if (that.signaling) {\n\
          that.signaling=false;\n\
          that.AJAX.abort();\n\
          that.AJAX=null;\n\
        }\n\
      }\n\
      this.close  = function(url) {\n\
        if (window.XMLHttpRequest) {\n\
          that.AJAX=new XMLHttpRequest();\n\
        } else {\n\
          that.AJAX=new ActiveXObject(\"Microsoft.XMLHTTP\");\n\
        }\n\
        if (that.AJAX) {\n\
           that.AJAX.open(\"GET\", urlCall + '?' + 'sid=" + str(scope.key()) + "&r=C', false);\n\
           that.AJAX.send(null);\n\
        } else {\n\
           return false;\n\
        }\n\
      }\n\
      this.signal = function(passData,postMethod) {\n\
        if (that.signaling) { return false; }\n\
        that.AJAX = null;\n\
        if (window.XMLHttpRequest) {\n\
          that.AJAX=new XMLHttpRequest();\n\
        } else {\n\
          that.AJAX=new ActiveXObject(\"Microsoft.XMLHTTP\");\n\
        }\n\
        if (that.AJAX==null) {\n\
          return false;\n\
        } else {\n\
          that.AJAX.onreadystatechange = function() {\n\
            if (that.AJAX.readyState==4) {\n\
              that.signaling=false;\n\
              that.callback(that.AJAX.responseText,that.AJAX.status,that.AJAX.responseXML);\n\
              that.AJAX=null;\n\
            }\n\
          }\n\
          that.signaling = new Date();\n\
          if (/post/i.test(postMethod)) {\n\
            var uri=urlCall+'?'+'sid=" + str(scope.key()) + "&r='+that.signaling.getTime();\n\
            that.AJAX.open(\"POST\", uri, true);\n\
            that.AJAX.setRequestHeader(\"Content-type\", \"application/x-www-form-urlencoded\");\n\
            that.AJAX.setRequestHeader(\"Content-Length\", passData.length);\n\
            that.AJAX.send(passData);\n\
          } else {\n\
            var uri=urlCall+'?'+'sid=" + str(scope.key()) + "&r='+passData+'&timestamp='+(that.signaling.getTime());\n\
            that.AJAX.open(\"GET\", uri, true);\n\
            that.AJAX.send(null);\n\
          }\n\
          return true;\n\
        }\n\
      }\n\
      var urlCall = url;\n\
      this.callback = callbackFunction || function () { };\n\
    }\n\
    function changeVolume(direction) {\n\
      if (uvPWR) {\n\
        if (!channelProgram) {\n\
          if (direction == \"uvVUP\") {\n\
            vol = vol + 10;\n\
            ytplayer.setVolume(vol);\n\
          }\n\
          if (direction == \"uvVDN\") {\n\
            vol = vol - 10;\n\
            ytplayer.setVolume(vol);\n\
          }\n\
          if (direction == \"uvMUT\") {\n\
            if (ytplayer.isMuted()) {\n\
              ytplayer.unMute();\n\
              document.getElementById(\"uvMUT\").style.backgroundColor=\"#000000\";\n\
            } else {\n\
              ytplayer.mute();\n\
              document.getElementById(\"uvMUT\").style.backgroundColor=\"#ff0000\";\n\
            }\n\
          }\n\
        } else {\n\
          if (direction == \"uvVUP\") {\n\
            if (currDepth == 0) {\n\
              currDepth = p.l;\n\
            } else {\n\
              currDepth = currDepth - 1;\n\
            }\n\
            var menu = \"\";\n\
            var i = 0;\n\
            while (i <= p.l) {\n\
              if (i == currDepth) {\n\
                menu = menu + \"<div class=\\\"mstdb grey4\\\"><font color=#ffc000>\" + p.m[i] + \"</font></div>\";\n\
              } else {\n\
                menu = menu + \"<div class=\\\"mstdb grey6\\\">\" + p.m[i] + \"</div>\";\n\
              }\n\
              i = i + 1;\n\
            }\n\
            document.getElementById(\"AS\").innerHTML=menu;\n\
          }\n\
          if (direction == \"uvVDN\") {\n\
            if (currDepth == p.l) {\n\
              currDepth = 0;\n\
            } else {\n\
              currDepth = currDepth + 1;\n\
            }\n\
            var menu = \"\";\n\
            var i = 0;\n\
            while (i <= p.l) {\n\
              if (i == currDepth) {\n\
                menu = menu + \"<div class=\\\"mstdb grey4\\\"><font color=#ffc00>\" + p.m[i] + \"</font></div>\";\n\
              } else {\n\
                menu = menu + \"<div class=\\\"mstdb grey6\\\">\" + p.m[i] + \"</div>\";\n\
              }\n\
              i = i + 1;\n\
            }\n\
            document.getElementById(\"AS\").innerHTML=menu;\n\
          }\n\
        }\n\
      }\n\
    }\n\
    function setCookie(name,value,expires, options) {\n\
       if (options===undefined) { options = {}; }\n\
       if ( expires ) {\n\
          var expires_date = new Date();\n\
          expires_date.setDate(expires_date.getDate() + expires)\n\
       }\n\
       document.cookie = name+'='+escape( value ) +\n\
          ( ( expires ) ? ';expires='+expires_date.toGMTString() : '' ) + \n\
          ( ( options.path ) ? ';path=' + options.path : '' ) +\n\
          ( ( options.domain ) ? ';domain=' + options.domain : '' ) +\n\
          ( ( options.secure ) ? ';secure' : '' );\n\
    }\n\
    function getCookie( name ) {\n\
       var start = document.cookie.indexOf( name + \"=\" );\n\
       var len = start + name.length + 1;\n\
       if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {\n\
          return null;\n\
       }\n\
       if ( start == -1 ) return null;\n\
       var end = document.cookie.indexOf( ';', len );\n\
       if ( end == -1 ) end = document.cookie.length;\n\
       return unescape( document.cookie.substring( len, end ) );\n\
    }\n\
    function deleteCookie( name, path, domain ) {\n\
       if ( getCookie( name ) ) document.cookie = name + '=' +\n\
          ( ( path ) ? ';path=' + path : '') +\n\
          ( ( domain ) ? ';domain=' + domain : '' ) +\n\
          ';expires=Thu, 01-Jan-1970 00:00:01 GMT';\n\
    }\n\
    function programScope(selection) {\n\
      if (uvPWR) {\n\
        if (channelProgram == false && selection == 'uvPRG') {\n\
          channelProgram = true;\n\
          setCookie('testCookie', 'test', 1);\n\
          if (!getCookie('testCookie')) {\n\
            alert(\"Cookies must be enabled for channel programming\");\n\
            return true;\n\
          }\n\
          deleteCookie('testCookie');\n\
          document.getElementById(\"AP\").innerHTML=\"<div class=mstd><font class=gurl>Channel Programming</font><br />\
          <font class=orb>Select Channel or FAV</font><br /><font class=norm>To customize the programming available on \
          channels 0-9 select the channel to be programmed or press FAV to assign a channel to the FAV button.</font><br />\
          <font class=orb>Enter Channel Information</font><br /><font class=norm>If you select a channel you will be prompted \
          to enter a channel 'Name', 'Description' and video 'Search Criteria' for the new channel. If you select FAV you will \
          be prompted to select a channel to assign to the FAV button.</font><br /><font class=orb>Press the PROG button</font><br />\
          <font class=norm>Pressing PROG again will assign programming to the selected channel, or assign the selected channel \
          to FAV button.</font></div>\";\n\
        } else if (channelProgram == true && selection == 'uvPRG') {\n\
          channelProgram = false;\n\
          document.getElementById(\"AP\").innerHTML=\"<div class=mstd><font class=orb>Google&#153 challenges you to use YouTube&#153 \
          in new and innovative ways.</font><br /><font class=norm>Embedding widgets and custom players is a quick and easy way to \
          bring YouTube&#153 to your website, but if you're looking to have programmatic access, the Data API is the way to go.</font></div>\";\n\
        } else {\n\
          alert(\"programScope, something other than channelProgram=true or false and selection=uvPRG\")\n\
          document.getElementById(\"AP\").innerHTML=\"<div class=mstd><font class=orb>Google&#153 challenges you to use YouTube&#153 \
          in new and innovative ways.</font><br /><font class=norm>Embedding widgets and custom players is a quick and easy way to \
          bring YouTube&#153 to your website, but if you're looking to have programmatic access, the Data API is the way to go.</font></div>\";\n\
          channelProgram = false;\n\
        }\n\
      }\n\
    }\n\
    function changeChannel(channel) {\n\
      if (uvPWR && channelProgram) {\n\
        if (channel == \"uvFAV\") {\n\
          document.getElementById(\"AP\").innerHTML=\
          \"<div class=mstdc>\
          <font class=gurl>Programming Channel \" + channel.substr(2) + \"</font>\
          </div>\
          <div class=mstdb>\
          <font class=orb>Select Channel to Assign</font>\
          </div>\
          <div id=AS class=mstdb>\
          <font class=norm>Select a channel to assign to the FAV button by clicking the desired channel button now. Channels 0 through 9 are available for assignment to the FAV button.</font>\
          </div>\";\n\
          programFav = true;\n\
          programChange.signal(\"uvPRG&channel=\" + channel);\n\
          return true;\n\
        } else {\n\
          if (programFav == true) {\n\
            programFav = false;\n\
            favChannel = channel;\n\
            alert(\"programFav=false and favChannel=\" + favChannel);\n\
            programChange.signal(\"uvPRG&channel=uvFAV&selection=\" + channel);\n\
          } else {\n\
            document.getElementById(\"AP\").innerHTML=\
            \"<div class=mstdc>\
            <font class=gurl>Programming Channel \" + channel.substr(2) + \"</font>\
            </div>\
            <div class=mstdb>\
            <font class=orb>Enter Channel Name</font>\
            </div>\
            <div class=mstdb>\
            <font class=norm><input id=AQ type=text class=cname></font>\
            </div>\
            <div class=mstdb>\
            <font class=orb>Enter Channel Description</font>\
            </div>\
            <div class=mstdb>\
            <textarea id=AR name=Message class=cdesc></textarea></font>\
            </div>\
            <div class=mstdb>\
            <font class=orb>Select Program Criteria</font>\
            </div>\
            <font class=norm>\
            <span id=AS>\
            </span>\
            <div class=mstd>\
            </div>\
            </font>\";\n\
            document.getElementById(\"AQ\").value=\"My new channel name\";\n\
            document.getElementById(\"AR\").innerHTML=\"Use vol + - and <<  >> buttons \
            to navigate the Program Criteria menu below.\
            \";\n\
            programChange.signal(\"uvPRG&channel=\" + channel);\n\
            return true;\n\
          }\n\
        }\n\
      }\n\
      if (uvPWR && !channelProgram) {\n\
        if (channel == \'uvCUP\') {\n\
          channelChange.signal(channel);\n\
        } else if (channel == \'uvCDN\') {\n\
          channelChange.signal(channel);\n\
        } else if (channel == \'uvPRE\') {\n\
          channelChange.signal(channel);\n\
        } else if (channel == \'uvFAV\') {\n\
          channelChange.signal(channel);\n\
        } else if (channel == \'uvINF\') {\n\
          if (!dispInfo) {\n\
            dispInfo = true;\n\
            channelInformation.signal(channel);\n\
          } else {\n\
            dispInfo = false;\n\
            document.getElementById(\"AO\").innerHTML=\"<div class=mstd>\
            <font class=orb>Google&#153 encourages you to build monetizable YouTube&#153 applications.</font><br />\
            <font class=norm>The Data API transforms YouTube&#153 into a video Storage Area Network, enabling devices, \
            webapps and desktop applications to upload, query and stream content in a completely customized manner.</font></div>\";\n\
          }\n\
        } else {\n\
          channelChange.signal(channel);\n\
        }\n\
      }\n\
    }\n\
    function changePosition(command) {\n\
      if (uvPWR) {\n\
        if (!channelProgram) {\n\
          if (command == \"||\") {\n\
            ytplayer.pauseVideo();\n\
            document.getElementById(\"uvPLY\").innerHTML=\">\";\n\
          }\n\
          if (command == \"&gt;\") {\n\
            ytplayer.playVideo();\n\
            document.getElementById(\"uvPLY\").innerHTML=\"||\";\n\
          }\n\
          if (command == \"uvFWD\") {\n\
            positionChange.signal(command);\n\
          }\n\
          if (command == \"uvBWD\") {\n\
            positionChange.signal(command);\n\
          }\n\
          if (command == \"\") {\n\
            positionChange.signal(\"uvFWD\");\n\
          }\n\
        } else {\n\
          if (command == \"uvFWD\") {\n\
            var n = escape(document.getElementById(\"AQ\").value);\n\
            var d = escape(document.getElementById(\"AR\").value);\n\
            programChange.signal(\"uvPRG&direction=\" + command + \"&selection=\" + currDepth + \"&n=\" + n + \"&d=\" + d);\n\
            currDepth = 0;\n\
          }\n\
          if (command == \"uvBWD\") {\n\
            programChange.signal(\"uvPRG&direction=\" + command);\n\
          }\n\
          if (command == \"||\") {\n\
            ytplayer.pauseVideo();\n\
            document.getElementById(\"uvPLY\").innerHTML=\">\";\n\
          }\n\
        }\n\
      }\n\
    }\n\
    function switchPower(state) {\n\
      if (!uvPWR) {\n\
        uvPWR = true;\n\
        document.getElementById(state).innerHTML=\"PWR OFF\";\n\
        var flashvars = {};\n\
        var params = { menu: \"false\", scale: \"exactfit\", allowScriptAccess: \"always\", bgcolor: \"#000000\" };\n\
        var atts = { id: \"myytplayer\" };\n\
        swfobject.embedSWF(\"http://www.youtube.com/apiplayer?enablejsapi=1&playerapiid=ytplayer\", \n\
                       \"ytapiplayer\", \"684\", \"212\", \"9.0.0\", null, flashvars, params, atts);\n\
      } else {\n\
        uvPWR = false;\n\
        document.getElementById(state).innerHTML=\"PWR ON\";\n\
        document.getElementById(\"scope\").innerHTML=\"<div id=ytapiplayer><img src=img/urlevision.gif width=684 height=212</div>\";\n\
        var uvButtons = new Array('uv0','uv1','uv2','uv3','uv4','uv5','uv6','uv7','uv8','uv9','uvMUT','uvPRG','uvINF');\n\
        var button;\n\
        for (button in uvButtons) {\n\
          document.getElementById(uvButtons[button]).style.backgroundColor=\"#000000\";\n\
        }\n\
        document.getElementById(\"AO\").innerHTML=\"<div class=mstd><font class=orb>Google&#153 encourages you to build monetizable \
        YouTube&#153 applications.</font><br /><font class=norm>The Data API transforms YouTube&#153 into a video Storage Area Network, enabling \
        devices, webapps and desktop applications to upload, query and stream content in a completely customized manner.</font></div>\";\n\
        document.getElementById(\"AP\").innerHTML=\"<div class=mstd><font class=orb>Google&#153 challenges you to use YouTube&#153 in new and \
        innovative ways.</font><br /><font class=norm>Embedding widgets and custom players is a quick and easy way to bring YouTube&#153 to \
        your website, but if you're looking to have programmatic access, the Data API is the way to go.</font></div>\";\n\
      }\n\
    }\n\
    function onYouTubePlayerReady(playerId) {\n\
      ytplayer = document.getElementById(\"myytplayer\");\n\
      ytplayer.addEventListener(\"onStateChange\", \"changePosition\");\n\
      ytplayer.addEventListener(\"onError\",       \"changePosition\");\n\
    }\n\
    </script>\n\
    </head>\n\
    <body id=AA onunload=\"channelState.close()\">\n\
    <table width=684px border=0 cellpadding=0 cellspacing=0 align=center>\n\
    <tr>\n\
    <td id=scope>\n\
    <div id=ytapiplayer>\n\
    <img src=img/urlevision.gif width=684px height=212px alt=URLeVision>\n\
    </div>\n"
    ################################################################
    #youtube_data_api PAGE_DESKTOP Generic page for DESKTOP browsers
    ################################################################
    PAGE_DESKTOP = "\
    </td>\n\
    </tr>\n\
    <tr>\n\
    <td>\n\
    <table width=684px border=0 cellpadding=0 cellspacing=0><tr><td></td><td align=left>\n\
    <button class=but6 onClick=\"window.location=\'About\'\" onmouseover=\"this.style.color=\'#ffc000\'\" \n\
    onmouseout=\"this.style.color=\'#a9a9a9\'\">About Us</button></td><td></td><td align=right>\n\
    <button class=but6 onClick=\"window.location=\'Services\'\" onmouseover=\"this.style.color=\'#ffc000\'\" \n\
    onmouseout=\"this.style.color=\'#a9a9a9\'\">Services</button></td><td></td><td align=center>\n\
    <button class=but6 onClick=\"window.location=\'Solutions\'\" onmouseover=\"this.style.color=\'#ffc000\'\" \n\
    onmouseout=\"this.style.color=\'#a9a9a9\'\">Solutions</button></td><td></td><td align=center>\n\
    <button class=but6 onClick=\"window.location=\'Support\'\" onmouseover=\"this.style.color=\'#ffc000\'\" \n\
    onmouseout=\"this.style.color=\'#a9a9a9\'\">Support</button></td><td></td><td align=center>\n\
    <button class=but6 onClick=\"window.location=\'Products\'\" onmouseover=\"this.style.color=\'#ffc000\'\" \n\
    onmouseout=\"this.style.color=\'#a9a9a9\'\">Products</button></td><td></td><td align=center>\n\
    <button class=but6 onClick=\"window.location=\'Contact\'\" onmouseover=\"this.style.color=\'#ffc000\'\" \n\
    onmouseout=\"this.style.color=\'#a9a9a9\'\">Contact Us</button></td><td></td></tr>\n\n\
    </table>\n\n\
    <table width=684px border=0 cellpadding=0 cellspacing=0 summary=content>\n\
    <tr valign=top>\n\
    <td id=AP rowspan=1 class=\"grey2 greyj\" width=198px>\n\
    <div class=mstd>\n\
    <font class=orb>\n\
    Google&#153 challenges you to use YouTube&#153 in new and innovative ways.\n\
    </font><br />\n\
    <font class=norm>\n\
    Embedding widgets and custom players is a quick and easy way to bring YouTube&#153 to your website, \n\
    but if you're looking to have programmatic access, the Data API is the way to go.\n\
    </font>\n\
    </div>\n\n\
    </td>\n\n\
    <td width=288px valign=top align=center style=\"background-color: #222222;\">\n\n\
    <table width=288px bgcolor=#000000 border=0 cellpadding=0 cellspacing=0>\n\n\
    <tr align=center valign=top>\n\n\
    <td align=left>\n\n\
    <button id=uvPWR onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ff0000\'\"\n\
    onclick=\"switchPower(this.id)\">PWR ON</button>\n\
    <td align=center>\n\
    <button id=uv1   onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\"\n\
    onclick=\"changeChannel(this.id)\">1</button>\n\
    <td align=center>\n\
    <button id=uv2   onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\"\n\
    onclick=\"changeChannel(this.id)\">2\n\
    </button>\n\
    <td align=center>\n\
    <button id=uv3   onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\"\n\
    onclick=\"changeChannel(this.id)\">3\n\
    </button>\n\
    <td align=right>\n\
    <button id=uvMUT onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\"\n\
    onclick=\"changeVolume(this.id)\">MUTE\n\
    </button>\n\
    </tr>\n\
    <tr align=center valign=top>\n\
    <td align=left>\n\
    <button id=uvVUP onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\"\n\
    onmousedown=\"this.style.backgroundColor=\'#ff0000\'\" onmouseup=\"this.style.backgroundColor=\'#000000\'\"\n\
    onclick=\"changeVolume(this.id)\">+\n\
    </button>\n\
    <td align=center>\n\
    <button id=uv4   onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\"\n\
    onclick=\"changeChannel(this.id)\">4\n\
    </button>\n\
    <td align=center>\n\
    <button id=uv5   onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\"\n\
    onclick=\"changeChannel(this.id)\">5\n\
    </button>\n\
    <td align=center>\n\
    <button id=uv6   onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\"\n\
    onclick=\"changeChannel(this.id)\">6\n\
    </button>\n\
    <td align=right>\n\
    <button id=uvCUP onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\"\n\
    onmousedown=\"this.style.backgroundColor=\'#ff0000\'\" onmouseup=\"this.style.backgroundColor=\'#000000\'\"\n\
    onclick=\"changeChannel(this.id)\">+\n\
    </button>\n\
    </tr>\n\
    <tr align=center valign=top>\n\
    <td align=center valign=middle>\n\
    VOL\n\
    <td align=center>\n\
    <button id=uv7   onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\"\n\
    onclick=\"changeChannel(this.id)\">7\n\
    </button>\n\
    <td align=center>\n\
    <button id=uv8   onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\"\n\
    onclick=\"changeChannel(this.id)\">8\n\
    </button>\n\
    <td align=center>\n\
    <button id=uv9   onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\"\n\
    onclick=\"changeChannel(this.id)\">9\n\
    </button>\n\
    <td align=center valign=middle>\n\
    CH\n\
    </tr>\n\
    <tr align=center valign=top>\n\
    <td align=left>\n\
    <button id=uvVDN onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\"\n\
    onmousedown=\"this.style.backgroundColor=\'#ff0000\'\" onmouseup=\"this.style.backgroundColor=\'#000000\'\"\n\
    onclick=\"changeVolume(this.id)\">-\n\
    </button>\n\
    <td align=center>\n\
    <button id=uvFAV onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\"\n\
    onmousedown=\"this.style.backgroundColor=\'#ff0000\'\" onmouseup=\"this.style.backgroundColor=\'#000000\'\"\n\
    onclick=\"changeChannel(this.id)\">FAV\n\
    </button>\n\
    <td align=center>\n\
    <button id=uv0   onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\"\n\
    onclick=\"changeChannel(this.id)\">0\n\
    </button>\n\
    <td align=center>\n\
    <button id=uvPRE onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\"\n\
    onmousedown=\"this.style.backgroundColor=\'#ff0000\'\" onmouseup=\"this.style.backgroundColor=\'#000000\'\"\n\
    onclick=\"changeChannel(this.id)\">PRV\n\
    </button>\n\
    <td align=right>\n\
    <button id=uvCDN onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\"\n\
    onmousedown=\"this.style.backgroundColor=\'#ff0000\'\" onmouseup=\"this.style.backgroundColor=\'#000000\'\"\n\
    onclick=\"changeChannel(this.id)\">-\n\
    </button>\n\
    </tr>\n\
    <tr align=center valign=top>\n\
    <td align=left>\n\
    <button id=uvPRG onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\"\n\
    onmousedown=\"this.style.backgroundColor=\'#ff0000\'\" onmouseup=\"this.style.backgroundColor=\'#000000\'\"\n\
    onclick=\"programScope(this.id)\">PROG\n\
    <td align=center>\n\
    <button id=uvBWD onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\"\n\
    onmousedown=\"this.style.backgroundColor=\'#ff0000\'\" onmouseup=\"this.style.backgroundColor=\'#000000\'\"\n\
    onclick=\"changePosition(this.id)\"><<\n\
    </button>\n\
    <td align=center>\n\
    <button id=uvPLY onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\"\n\
    onmousedown=\"this.style.backgroundColor=\'#ff0000\'\" onmouseup=\"this.style.backgroundColor=\'#000000\'\"\n\
    onclick=\"changePosition(this.innerHTML)\">||</button>\n\
    <td align=center>\n\
    <button id=uvFWD onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\"\n\
    onmousedown=\"this.style.backgroundColor=\'#ff0000\'\" onmouseup=\"this.style.backgroundColor=\'#000000\'\"\n\
    onclick=\"changePosition(this.id)\">>>\n\
    </button>\n\
    <td align=right>\n\
    <button id=uvINF onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\"\n\
    onmousedown=\"this.style.backgroundColor=\'#ff0000\'\" onmouseup=\"this.style.backgroundColor=\'#000000\'\"\n\
    onclick=\"changeChannel(this.id)\" value=\"\">INFO\n\
    </tr>\n\
    </table>\n\
    </td>\n\
    <td id=AO class=\"grey3 greyj\" width=198px>\n\
    <div class=mstd>\n\
    <font class=orb>\n\
    Google&#153 encourages you to build monetizable YouTube&#153 applications.\n\
    </font><br />\n\
    <font class=norm>\n\
    The Data API transforms YouTube&#153 into a video Storage Area Network, enabling devices, webapps and desktop applications \n\
    to upload, query and stream content in a completely customized manner.\n\
    </font>\n\
    </div>\n\
    </td>\n\
    </tr>\n\
    </table>"
    #############################################################################
    #youtube_data_api PAGE_MOBILE_LOW_END Generic page for low-end mobile devices
    #############################################################################
    PAGE_MOBILE_LOW_END = "\
    <div class=grey2>\
    <font class=odd>Under </font><font class=url>Construction</font>\
    </div>"
    global DEVICE
    detectDevice()
    if DEVICE == "DESKTOP":
      self.response.out.write(PAGE_HEADER_DESKTOP)
      self.response.out.write(URLESCOPE)
      self.response.out.write(PAGE_DESKTOP)
      self.response.out.write(PAGE_FOOTER_DESKTOP)
    if DEVICE == "MOBILE_LOW_END":
      self.response.out.write(PAGE_HEADER_MOBILE_LOW_END)
      self.response.out.write(STYLE_SHEET_MOBILE_LOW_END)
      self.response.out.write(MAIN_MENU_MOBILE_LOW_END)
      self.response.out.write(PAGE_MOBILE_LOW_END)
      self.response.out.write(PAGE_FOOTER_MOBILE_LOW_END)

#######################################################################################
#newrlescope is a JavaScript YouTube player designed to mimic a television remote control
#######################################################################################
class newrlescope(webapp.RequestHandler):
  def get(self):
    ########################################################
    #Load the datastore with default values for a new viewer
    ########################################################
    scope                 = URLeScope()
    scope.uvPWR           = "false"
    scope.uvVewing        = "false"
    scope.dispInfo        = "false"
    scope.currChannel     = 0
    scope.prevChannel     = 0
    scope.favChannel      = 3
    scope.progScope       = 0
    scope.uv0seq          = 0
    scope.uv0name         = "<i>The Photo-Drama of Creation</i>"
    scope.uv0desc         = "A religious film produced under the direction of <a class=link target=_blank \
                             href=http://en.wikipedia.org/wiki/Charles_Taze_Russell>Charles Taze Russell</a>, the founder of the \
                             Bible Student movement. Production was completed Drama was completed in 1914. It has the distinction \
                             of being the first major screenplay to incorporate synchronized sound, moving film, and color slides."
    scope.uv0             = ['a7cF0nw5S-g','HwdiZ27PqNs','xLKIKh7hjoc','i8UXC_GNZRs','A3St39wp4dY','ElKjeiGO-Sw','dzqWTdDaseA',\
                             '0DNdO8og-f4','BF-wtKLJ92w','fWZrBTd7IXY','4AHZ1tabRK8','tNItrj7cphg','w5RLikpbKDY','t_XbWHOFLto',\
                             'SdOjszWOPEM','R1ATRO7SUIA','m7fbWz_fOqc','Ye_qtJZQS98','K5k_yTXWkXk','ifcT2g-zvg8','iOoOpPza1KI',\
                             'G9QLXPyKSyc','kmgJGq_lDVw','PrD4V69ssyI','XDUKGaq5XzQ','BWYEGR5gA1A','X_F2t425BWE','OMJ8jKP2Ans',\
                             'tVDIJRLTDz8','Qr_T3ASSeT0']
    scope.uv0info         = ['Intro. to Part I','Part 1 of 96','Part   2 of 96','Part   3 of 96','Part   4 of 96','Part   5 of 96',\
                             'Part   6 of 96','Part   7 of 96','Part   8 of 96','Part   9 of 96','Part  10 of 96','Part  11 of 96',\
                             'Part  12 of 96','Part  13 of 96','Part  14 of 96','Part  15 of 96','Part  16 of 96','Part  17 of 96',\
                             'Part  18 of 96','Part  19 of 96','Part  20 of 96','Part  21 of 96','Part  22 of 96','Part  23 of 96',\
                             'Part  24 of 96','Part  25 of 96','Part  26 of 96','Part  27 of 96','Part  28 of 96','Part  29 of 96',]
    scope.uv1seq          = 0
    scope.uv1name         = "Flying Boats"
    scope.uv1desc         = "One of the finest collection of aviation videos on the web, bomberguy specializes in news reel footage of vintage \
                             aircraft. My favorite are the flying boats. What&#39s your&#39s?"
    scope.uv1             = ['R4EgOj0WKRA','eo8VxPC6JlI','SOrj2cSDO-M','z3ZoXdqZLJ8','qKJQtnUulDo','fqbTgsE-DuY','Wy86aHpOdkg','PmuNQXst6nI',\
                             'fF3K9DEvvts','YkXCGn8-Np8','AV1eUeo27tc','dIVW-1ATuiw','eXQaKDs6OUs','hSm0nq9qbKA','7h1beFHjHno','dNqHENNmChU',\
                             'bYtazEBQ1K8','qxUncWwSTYs','6pl1aMVnZyY','iruRnuM373Y','ZDG5SFJ337A','EMu4Cw_yBRI']
    scope.uv1info         = ['Be-200 MULTIPURPOSE AMPHIBIOUS AIRCRAFT','Mars Flying Boats','Convair F2Y Sea Dart','Dornier Superwal 1926',\
                             'Latcore 521 Lieutenant de Vaisseau Paris','Sikorsky S-40 Flying Boat','Short S.40 Shetland II Flying Boat',\
                             'Short S.17 Kent Flying Boat','Beriev A 40 Albatross','Blriot 5190 Flying Boat','Saunders-Roe Princess Flying Boat',\
                             'Sukhoi Be-103','Beardmore Inverness flying boat','Blackburn Iris Flying Boat','A flight aboard the DoX - 1930',\
                             'Consolidated PBY Catalina with the RAF','The Short Mayo Composite','Saunders Roe SR A-1',\
                             'Sanders Roe SR A/1 and Convair Sea Dart','Canadair CL-415 By Simone DAscenzi','Russian Be-12',\
                             'Beriev Be-10']
    scope.uv2seq          = 0
    scope.uv2name         = "Seth MacFarlane&#39s <a class=link tatget=_blank \
                             href=http://en.wikipedia.org/wiki/Seth_MacFarlane%27s_Cavalcade_of_Cartoon_Comedy>\
                             Cavalcade of Cartoon Comedy</a>"
    scope.uv2desc         = "An American animated cartoon web series created by Seth MacFarlane."
    scope.uv2             = ['ghZ_dkxOwEY','o_kbOQIg4sM','WSQvc6VWrPY','as5KLmbLUjI']
    scope.uv2info         = ['Super Mario Rescues The Princess','A Dog on The $25,000 Pyramid',\
                             'Why Bob Marley Should Not Have Acted as His Own Attorney','Adopted']
    scope.uv3seq          = 0
    scope.uv3name         = "Music URLeVision"
    scope.uv3desc         = "Web 2.5 version of the classic TV network."
    scope.uv3             = ['_f2YeGu6Xqw','bU1514VkDkc','envYjehnvLg','jhPAK8HjcPI','vjMGtb3MDWo','VPkcwBVhi-8']
    scope.uv3info         = ['<a target=_blank class=link href=http://www.reverbnation.com/rickcastro>Rick Castro</a> - Mr. Tinker Man',\
                             'Miley Cyrus - 7 Things','Rihanna - Live Unfaithful',\
                             'Alicia Keys - If I Aint Got You','LeAnn Rimes - Can&#39t Fight The Moonlight',\
                             'Taylor Swift HD &#39LOVE STORY&#39 GREATEST LIVE PERFORMANCE EVER!']
    scope.uv4seq          = 0
    scope.uv4name         = "Classic Commercials"
    scope.uv4desc         = "Thank goodness we don&#39t have to watch these anymore."
    scope.uv4             = ['OYecfV3ubP8','mSHo3j72fIo']
    scope.uv4info         = ['OYecfV3ubP8','mSHo3j72fIo']
    scope.uv5seq          = 0
    scope.uv5name         = "FOX News, fair and balanced"
    scope.uv5desc         = "Right wing retoric from FOX."
    scope.uv5             = ['ouKJixL--ms','CWHq6v2tfP0','1SiVasR2Gzo','dN823dUu6KA','MWZHTJsR4Bc','LcPF59CoGvs','nLkQeuU1LmM']
    scope.uv5info         = ['ouKJixL--ms','CWHq6v2tfP0','1SiVasR2Gzo','dN823dUu6KA','MWZHTJsR4Bc','LcPF59CoGvs','nLkQeuU1LmM']
    scope.uv6seq          = 0
    scope.uv6name         = "Google Developers"
    scope.uv6desc         = "The best of Google APIs"
    scope.uv6             = ['xZwH_2MVmKI','u1zgFlCw8Aw','usxO-nLyO0M']
    scope.uv6info         = ['xZwH_2MVmKI','u1zgFlCw8Aw','usxO-nLyO0M']
    scope.uv7seq          = 0
    scope.uv7name         = "The Squirrel Channel"
    scope.uv7desc         = "Gotta love the little tree rats."
    scope.uv7             = ['ZGhZHlpSE6k','cd5Hvghe58k','TamMqvk4Bb8','GcfWD62sbcs','8cCFn55Zxkc','ADuSnt6PFn8']
    scope.uv7info         = ['ZGhZHlpSE6k','cd5Hvghe58k','TamMqvk4Bb8','GcfWD62sbcs','8cCFn55Zxkc','ADuSnt6PFn8']
    scope.uv8seq          = 0
    scope.uv8name         = "Movie Trailers"
    scope.uv8desc         = "New movies comming to a theatre near you."
    scope.uv8             = ['d1_JBMrrYw8','Wo85qZm-Zuk','KsGuzZqVeQU','LjMkNrX60mA','nQ6MDCUfxvY','ZPieOzIA7NM','LjMkNrX60mA']
    scope.uv8info         = ['<a class=link target=_blank href=http://www.avatarmovie.com>Avatar</a> Director: James Cameron Release: 12/18/2009 Aparaplegic war veteran is brought to the planet Pandora which is inhabited by the Navi. The Navi is a humanoid race with their own language and culture, but the people of Earth find themselves at odds with the Navi.','Wo85qZm-Zuk','KsGuzZqVeQU','LjMkNrX60mA','nQ6MDCUfxvY','ZPieOzIA7NM','LjMkNrX60mA']
    scope.uv9seq          = 0
    scope.uv9name         = "Jehovah&#39s Witnesses, fair and balanced"
    scope.uv9desc         = "Jehovah&#39s Witnesses is a restorationist, millenarian Christian denomination. They are directed by the Governing \
                             Body, a group  of elders which exercises authority on all doctrinal matters, based on their interpretation of \
                             the Bible, with preference given to their own translation, the New World Translation of the Holy Scriptures."
    scope.uv9             = ['Dt47lPS_QEw','k0lyLjI5X_o','Jk441bKj-7k','6c6I0fjiYNU','xUmp18CeQE8','pf8za39Aa-g','PEPtLJurxy0',\
                             'C7U4i8LnOow','ZlHbz5G4UTM','9uP7UftOMTI','KEup8CVDmPQ','EB2aljuY_-M','kjtBq5mG_Wg','C7U4i8LnOow']
    scope.uv9info         = ['Dt47lPS_QEw','k0lyLjI5X_o','Jk441bKj-7k','6c6I0fjiYNU','xUmp18CeQE8','pf8za39Aa-g','PEPtLJurxy0',\
                             'C7U4i8LnOow','ZlHbz5G4UTM','9uP7UftOMTI','KEup8CVDmPQ','EB2aljuY_-M','kjtBq5mG_Wg','C7U4i8LnOow']
    scope.put()
    ####################################################################################
    #URLESCOPE JavaScript object containing the YouTube player and URLeVision client API
    ####################################################################################
    YOUTUBE_MAIN_MENU_DESKTOP = MAIN_MENU_DESKTOP.replace("AC.gif", "urlevision.gif")
    URLESCOPE = "\
    <link rel=\"stylesheet\" type=\"text/css\" href=\"css/style.css\" />\n\
    <!--[if lt IE 7]>\n\
     <link rel=\"stylesheet\" href=\"css/ie6.css\" />\n\
    <![endif]-->\n\
    <script src=\"http://www.google.com/jsapi\"></script>\n\
    <script>\n\
    google.load(\"swfobject\", \"2.2\");\n\
    </script>\n\
    <script>\n\
    var vol                 = 50;\n\
    var currDepth           = 0;\n\
    var dispInfo            = " + scope.dispInfo + ";\n\
    var uvPWR               = " + scope.uvPWR + ";\n\
    var progScope           = \"" + str(scope.progScope)   + "\";\n\
    var currChannel         = \"" + str(scope.currChannel) + "\";\n\
    var prevChannel         = \"" + str(scope.prevChannel) + "\";\n\
    var favChannel          = \"" + str(scope.favChannel)  + "\";\n\
    var channelProgram      = false;\n\
    var programFav          = false;\n\
    var channelChange       = new URLsignal('URLeVision');\n\
    var positionChange      = new URLsignal('URLeVision');\n\
    var programChange       = new URLsignal('URLeVision');\n\
    var channelState        = new URLsignal('URLeVision');\n\
    var channelInformation  = new URLsignal('URLeVision');\n\
    channelChange.callback  = function(responseText, responseStatus, responseXML) {\n\
      eval(responseText);\n\
      if (dispInfo) {\n\
        ytplayer.loadVideoById(c.S, 0);\n\
        document.getElementById(\"uv\" + c.P).style.backgroundColor=\"#000000\";\n\
        document.getElementById(\"uv\" + c.C).style.backgroundColor=\"#ff0000\";\n\
        document.getElementById(\"AO\").innerHTML=\"<div class=mstd><font class=gurl>Information:</font><br />\
        <font class=orb>Channel Name:</font><br /><font class=norm>\" + c.N + \"</font><br />\
        <font class=orb>Channel Description:</font><br /><font class=norm>\" + c.D + \"</font><br />\
        <font class=orb>Now Playing:</font><br /><font class=norm>\" + c.I + \"</font></div>\";\n\
      } else {\n\
        ytplayer.loadVideoById(c.S, 0);\n\
        document.getElementById(\"uv\" + c.P).style.backgroundColor=\"#000000\";\n\
        document.getElementById(\"uv\" + c.C).style.backgroundColor=\"#ff0000\";\n\
      }\n\
    }\n\
    positionChange.callback = function(responseText, responseStatus, responseXML) {\n\
      eval(responseText);\n\
      if (dispInfo) {\n\
        ytplayer.loadVideoById(s.S, 0);\n\
        document.getElementById(\"AO\").innerHTML=\"<div class=mstd><font class=gurl>Channel Information:</font><br />\
        <font class=orb>Channel Name:</font><br /><font class=norm>\" + s.N + \"</font><br /><font class=orb>Channel Description:</font><br />\
        <font class=norm>\" + s.D + \"</font><br /><font class=orb>Now Playing:</font><br /><font class=norm>\" + s.I + \"</font></div>\";\n\
      } else {\n\
        ytplayer.loadVideoById(s.S, 0);\n\
      }\n\
    }\n\
    programChange.callback = function(responseText, responseStatus, responseXML) {\n\
      eval(responseText);\n\
      var menu = \"\";\n\
      var i = 0;\n\
      while (i <= p.l) {\n\
        if (i == currDepth) {\n\
          menu = menu + \"<div class=\\\"mstdb grey4\\\"><font color=#ffc000>\" + p.m[i++] + \"</font></div>\";\n\
        } else {\n\
          menu = menu + \"<div class=\\\"mstdb grey6\\\">\" + p.m[i++] + \"</div>\";\n\
        }\n\
      }\n\
      document.getElementById(\"AS\").innerHTML=menu;\n\
    }\n\
    channelInformation.callback = function(responseText, responseStatus, responseXML) {\n\
      eval(responseText);\n\
      document.getElementById(\"AO\").innerHTML=\"<div class=mstd><font class=gurl>Channel Information:</font><br />\
      <font class=orb>Channel Name:</font><br /><font class=norm>\" + i.N + \"</font><br /><font class=orb>Channel Description:</font><br />\
      <font class=norm>\" + i.D + \"</font><br /><font class=orb>Now Playing:</font><br /><font class=norm>\" + i.I + \"</font></div>\";\n\
    }\n\
    function URLsignal(url, callbackFunction) {\n\
      var that=this;      \n\
      this.signaling = false;\n\
      this.abort = function() {\n\
        if (that.signaling) {\n\
          that.signaling=false;\n\
          that.AJAX.abort();\n\
          that.AJAX=null;\n\
        }\n\
      }\n\
      this.close  = function(url) {\n\
        if (window.XMLHttpRequest) {\n\
          that.AJAX=new XMLHttpRequest();\n\
        } else {\n\
          that.AJAX=new ActiveXObject(\"Microsoft.XMLHTTP\");\n\
        }\n\
        if (that.AJAX) {\n\
           that.AJAX.open(\"GET\", urlCall + '?' + 'sid=" + str(scope.key()) + "&r=C', false);\n\
           that.AJAX.send(null);\n\
        } else {\n\
           return false;\n\
        }\n\
      }\n\
      this.signal = function(passData,postMethod) {\n\
        if (that.signaling) { return false; }\n\
        that.AJAX = null;\n\
        if (window.XMLHttpRequest) {\n\
          that.AJAX=new XMLHttpRequest();\n\
        } else {\n\
          that.AJAX=new ActiveXObject(\"Microsoft.XMLHTTP\");\n\
        }\n\
        if (that.AJAX==null) {\n\
          return false;\n\
        } else {\n\
          that.AJAX.onreadystatechange = function() {\n\
            if (that.AJAX.readyState==4) {\n\
              that.signaling=false;\n\
              that.callback(that.AJAX.responseText,that.AJAX.status,that.AJAX.responseXML);\n\
              that.AJAX=null;\n\
            }\n\
          }\n\
          that.signaling = new Date();\n\
          if (/post/i.test(postMethod)) {\n\
            var uri=urlCall+'?'+'sid=" + str(scope.key()) + "&r='+that.signaling.getTime();\n\
            that.AJAX.open(\"POST\", uri, true);\n\
            that.AJAX.setRequestHeader(\"Content-type\", \"application/x-www-form-urlencoded\");\n\
            that.AJAX.setRequestHeader(\"Content-Length\", passData.length);\n\
            that.AJAX.send(passData);\n\
          } else {\n\
            var uri=urlCall+'?'+'sid=" + str(scope.key()) + "&r='+passData+'&timestamp='+(that.signaling.getTime());\n\
            that.AJAX.open(\"GET\", uri, true);\n\
            that.AJAX.send(null);\n\
          }\n\
          return true;\n\
        }\n\
      }\n\
      var urlCall = url;\n\
      this.callback = callbackFunction || function () { };\n\
    }\n\
    function changeVolume(direction) {\n\
      if (uvPWR) {\n\
        if (!channelProgram) {\n\
          if (direction == \"uvVUP\") {\n\
            vol = vol + 10;\n\
            ytplayer.setVolume(vol);\n\
          }\n\
          if (direction == \"uvVDN\") {\n\
            vol = vol - 10;\n\
            ytplayer.setVolume(vol);\n\
          }\n\
          if (direction == \"uvMUT\") {\n\
            if (ytplayer.isMuted()) {\n\
              ytplayer.unMute();\n\
              document.getElementById(\"uvMUT\").style.backgroundColor=\"#000000\";\n\
            } else {\n\
              ytplayer.mute();\n\
              document.getElementById(\"uvMUT\").style.backgroundColor=\"#ff0000\";\n\
            }\n\
          }\n\
        } else {\n\
          if (direction == \"uvVUP\") {\n\
            if (currDepth == 0) {\n\
              currDepth = p.l;\n\
            } else {\n\
              currDepth = currDepth - 1;\n\
            }\n\
            var menu = \"\";\n\
            var i = 0;\n\
            while (i <= p.l) {\n\
              if (i == currDepth) {\n\
                menu = menu + \"<div class=\\\"mstdb grey4\\\"><font color=#ffc000>\" + p.m[i] + \"</font></div>\";\n\
              } else {\n\
                menu = menu + \"<div class=\\\"mstdb grey6\\\">\" + p.m[i] + \"</div>\";\n\
              }\n\
              i = i + 1;\n\
            }\n\
            document.getElementById(\"AS\").innerHTML=menu;\n\
          }\n\
          if (direction == \"uvVDN\") {\n\
            if (currDepth == p.l) {\n\
              currDepth = 0;\n\
            } else {\n\
              currDepth = currDepth + 1;\n\
            }\n\
            var menu = \"\";\n\
            var i = 0;\n\
            while (i <= p.l) {\n\
              if (i == currDepth) {\n\
                menu = menu + \"<div class=\\\"mstdb grey4\\\"><font color=#ffc00>\" + p.m[i] + \"</font></div>\";\n\
              } else {\n\
                menu = menu + \"<div class=\\\"mstdb grey6\\\">\" + p.m[i] + \"</div>\";\n\
              }\n\
              i = i + 1;\n\
            }\n\
            document.getElementById(\"AS\").innerHTML=menu;\n\
          }\n\
        }\n\
      }\n\
    }\n\
    function setCookie(name,value,expires, options) {\n\
       if (options===undefined) { options = {}; }\n\
       if ( expires ) {\n\
          var expires_date = new Date();\n\
          expires_date.setDate(expires_date.getDate() + expires)\n\
       }\n\
       document.cookie = name+'='+escape( value ) +\n\
          ( ( expires ) ? ';expires='+expires_date.toGMTString() : '' ) + \n\
          ( ( options.path ) ? ';path=' + options.path : '' ) +\n\
          ( ( options.domain ) ? ';domain=' + options.domain : '' ) +\n\
          ( ( options.secure ) ? ';secure' : '' );\n\
    }\n\
    function getCookie( name ) {\n\
       var start = document.cookie.indexOf( name + \"=\" );\n\
       var len = start + name.length + 1;\n\
       if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {\n\
          return null;\n\
       }\n\
       if ( start == -1 ) return null;\n\
       var end = document.cookie.indexOf( ';', len );\n\
       if ( end == -1 ) end = document.cookie.length;\n\
       return unescape( document.cookie.substring( len, end ) );\n\
    }\n\
    function deleteCookie( name, path, domain ) {\n\
       if ( getCookie( name ) ) document.cookie = name + '=' +\n\
          ( ( path ) ? ';path=' + path : '') +\n\
          ( ( domain ) ? ';domain=' + domain : '' ) +\n\
          ';expires=Thu, 01-Jan-1970 00:00:01 GMT';\n\
    }\n\
    function programScope(selection) {\n\
      if (uvPWR) {\n\
        if (channelProgram == false && selection == 'uvPRG') {\n\
          channelProgram = true;\n\
          setCookie('testCookie', 'test', 1);\n\
          if (!getCookie('testCookie')) {\n\
            alert(\"Cookies must be enabled for channel programming\");\n\
            return true;\n\
          }\n\
          deleteCookie('testCookie');\n\
          document.getElementById(\"AP\").innerHTML=\"<div class=mstd><font class=gurl>Channel Programming</font><br />\
          <font class=orb>Select Channel or FAV</font><br /><font class=norm>To customize the programming available on \
          channels 0-9 select the channel to be programmed or press FAV to assign a channel to the FAV button.</font><br />\
          <font class=orb>Enter Channel Information</font><br /><font class=norm>If you select a channel you will be prompted \
          to enter a channel 'Name', 'Description' and video 'Search Criteria' for the new channel. If you select FAV you will \
          be prompted to select a channel to assign to the FAV button.</font><br /><font class=orb>Press the PROG button</font><br />\
          <font class=norm>Pressing PROG again will assign programming to the selected channel, or assign the selected channel \
          to FAV button.</font></div>\";\n\
        } else if (channelProgram == true && selection == 'uvPRG') {\n\
          channelProgram = false;\n\
          document.getElementById(\"AP\").innerHTML=\"<div class=mstd><font class=orb>Google&#153 challenges you to use YouTube&#153 \
          in new and innovative ways.</font><br /><font class=norm>Embedding widgets and custom players is a quick and easy way to \
          bring YouTube&#153 to your website, but if you're looking to have programmatic access, the Data API is the way to go.</font></div>\";\n\
        } else {\n\
          alert(\"programScope, something other than channelProgram=true or false and selection=uvPRG\")\n\
          document.getElementById(\"AP\").innerHTML=\"<div class=mstd><font class=orb>Google&#153 challenges you to use YouTube&#153 \
          in new and innovative ways.</font><br /><font class=norm>Embedding widgets and custom players is a quick and easy way to \
          bring YouTube&#153 to your website, but if you're looking to have programmatic access, the Data API is the way to go.</font></div>\";\n\
          channelProgram = false;\n\
        }\n\
      }\n\
    }\n\
    function changeChannel(channel) {\n\
      if (uvPWR && channelProgram) {\n\
        if (channel == \"uvFAV\") {\n\
          document.getElementById(\"AP\").innerHTML=\
          \"<div class=mstdc>\
          <font class=gurl>Programming Channel \" + channel.substr(2) + \"</font>\
          </div>\
          <div class=mstdb>\
          <font class=orb>Select Channel to Assign</font>\
          </div>\
          <div id=AS class=mstdb>\
          <font class=norm>Select a channel to assign to the FAV button by clicking the desired channel button now. Channels 0 through 9 are available for assignment to the FAV button.</font>\
          </div>\";\n\
          programFav = true;\n\
          programChange.signal(\"uvPRG&channel=\" + channel);\n\
          return true;\n\
        } else {\n\
          if (programFav == true) {\n\
            programFav = false;\n\
            favChannel = channel;\n\
            alert(\"programFav=false and favChannel=\" + favChannel);\n\
            programChange.signal(\"uvPRG&channel=uvFAV&selection=\" + channel);\n\
          } else {\n\
            document.getElementById(\"AP\").innerHTML=\
            \"<div class=mstdc>\
            <font class=gurl>Programming Channel \" + channel.substr(2) + \"</font>\
            </div>\
            <div class=mstdb>\
            <font class=orb>Enter Channel Name</font>\
            </div>\
            <div class=mstdb>\
            <font class=norm><input id=AQ type=text class=cname></font>\
            </div>\
            <div class=mstdb>\
            <font class=orb>Enter Channel Description</font>\
            </div>\
            <div class=mstdb>\
            <textarea id=AR name=Message class=cdesc></textarea></font>\
            </div>\
            <div class=mstdb>\
            <font class=orb>Select Program Criteria</font>\
            </div>\
            <font class=norm>\
            <span id=AS>\
            </span>\
            <div class=mstd>\
            </div>\
            </font>\";\n\
            document.getElementById(\"AQ\").value=\"My new channel name\";\n\
            document.getElementById(\"AR\").innerHTML=\"Use vol + - and <<  >> buttons \
            to navigate the Program Criteria menu below.\
            \";\n\
            programChange.signal(\"uvPRG&channel=\" + channel);\n\
            return true;\n\
          }\n\
        }\n\
      }\n\
      if (uvPWR && !channelProgram) {\n\
        if (channel == \'uvCUP\') {\n\
          channelChange.signal(channel);\n\
        } else if (channel == \'uvCDN\') {\n\
          channelChange.signal(channel);\n\
        } else if (channel == \'uvPRE\') {\n\
          channelChange.signal(channel);\n\
        } else if (channel == \'uvFAV\') {\n\
          channelChange.signal(channel);\n\
        } else if (channel == \'uvINF\') {\n\
          if (!dispInfo) {\n\
            dispInfo = true;\n\
            channelInformation.signal(channel);\n\
          } else {\n\
            dispInfo = false;\n\
            document.getElementById(\"AO\").innerHTML=\"<div class=mstd>\
            <font class=orb>Google&#153 encourages you to build monetizable YouTube&#153 applications.</font><br />\
            <font class=norm>The Data API transforms YouTube&#153 into a video Storage Area Network, enabling devices, \
            webapps and desktop applications to upload, query and stream content in a completely customized manner.</font></div>\";\n\
          }\n\
        } else {\n\
          channelChange.signal(channel);\n\
        }\n\
      }\n\
    }\n\
    function changePosition(command) {\n\
      if (uvPWR) {\n\
        if (!channelProgram) {\n\
          if (command == \"||\") {\n\
            ytplayer.pauseVideo();\n\
            document.getElementById(\"uvPLY\").innerHTML=\">\";\n\
          }\n\
          if (command == \"&gt;\") {\n\
            ytplayer.playVideo();\n\
            document.getElementById(\"uvPLY\").innerHTML=\"||\";\n\
          }\n\
          if (command == \"uvFWD\") {\n\
            positionChange.signal(command);\n\
          }\n\
          if (command == \"uvBWD\") {\n\
            positionChange.signal(command);\n\
          }\n\
          if (command == \"\") {\n\
            positionChange.signal(\"uvFWD\");\n\
          }\n\
        } else {\n\
          if (command == \"uvFWD\") {\n\
            var n = escape(document.getElementById(\"AQ\").value);\n\
            var d = escape(document.getElementById(\"AR\").value);\n\
            programChange.signal(\"uvPRG&direction=\" + command + \"&selection=\" + currDepth + \"&n=\" + n + \"&d=\" + d);\n\
            currDepth = 0;\n\
          }\n\
          if (command == \"uvBWD\") {\n\
            programChange.signal(\"uvPRG&direction=\" + command);\n\
          }\n\
          if (command == \"||\") {\n\
            ytplayer.pauseVideo();\n\
            document.getElementById(\"uvPLY\").innerHTML=\">\";\n\
          }\n\
        }\n\
      }\n\
    }\n\
    function switchPower(state) {\n\
      if (!uvPWR) {\n\
        uvPWR = true;\n\
        document.getElementById(state).innerHTML=\"PWR OFF\";\n\
        var flashvars = {};\n\
        var params = { menu: \"false\", scale: \"exactfit\", allowScriptAccess: \"always\", bgcolor: \"#000000\" };\n\
        var atts = { id: \"myytplayer\" };\n\
        swfobject.embedSWF(\"http://www.youtube.com/apiplayer?enablejsapi=1&playerapiid=ytplayer\", \n\
                       \"ytapiplayer\", \"684\", \"212\", \"9.0.0\", null, flashvars, params, atts);\n\
      } else {\n\
        uvPWR = false;\n\
        document.getElementById(state).innerHTML=\"PWR ON\";\n\
        document.getElementById(\"scope\").innerHTML=\"<div id=ytapiplayer><img src=img/urlevision.gif width=684 height=212</div>\";\n\
        var uvButtons = new Array('uv0','uv1','uv2','uv3','uv4','uv5','uv6','uv7','uv8','uv9','uvMUT','uvPRG','uvINF');\n\
        var button;\n\
        for (button in uvButtons) {\n\
          document.getElementById(uvButtons[button]).style.backgroundColor=\"#000000\";\n\
        }\n\
        document.getElementById(\"AO\").innerHTML=\"<div class=mstd><font class=orb>Google&#153 encourages you to build monetizable \
        YouTube&#153 applications.</font><br /><font class=norm>The Data API transforms YouTube&#153 into a video Storage Area Network, enabling \
        devices, webapps and desktop applications to upload, query and stream content in a completely customized manner.</font></div>\";\n\
        document.getElementById(\"AP\").innerHTML=\"<div class=mstd><font class=orb>Google&#153 challenges you to use YouTube&#153 in new and \
        innovative ways.</font><br /><font class=norm>Embedding widgets and custom players is a quick and easy way to bring YouTube&#153 to \
        your website, but if you're looking to have programmatic access, the Data API is the way to go.</font></div>\";\n\
      }\n\
    }\n\
    function onYouTubePlayerReady(playerId) {\n\
      ytplayer = document.getElementById(\"myytplayer\");\n\
      ytplayer.addEventListener(\"onStateChange\", \"changePosition\");\n\
      ytplayer.addEventListener(\"onError\",       \"changePosition\");\n\
    }\n\
    </script>\n\
    </head>\n\
    <body id=AA onunload=\"channelState.close()\">\n\
    <table width=684px border=0 cellpadding=0 cellspacing=0 align=center>\n\
    <tr>\n\
    <td id=scope>\n\
    <div id=ytapiplayer>\n\
    <img src=img/urlevision.gif width=684px height=212px alt=URLeVision>\n\
    </div>\n"
    ################################################################
    #youtube_data_api PAGE_DESKTOP Generic page for DESKTOP browsers
    ################################################################
    PAGE_DESKTOP = "\
    </td>\n\
    </tr>\n\
    <tr>\n\
    <td>\n\
    <table width=684px border=0 cellpadding=0 cellspacing=0><tr><td></td><td align=left>\n\
    <button class=but6 onClick=\"window.location=\'About\'\" onmouseover=\"this.style.color=\'#ffc000\'\" \n\
    onmouseout=\"this.style.color=\'#a9a9a9\'\">About Us</button></td><td></td><td align=right>\n\
    <button class=but6 onClick=\"window.location=\'Services\'\" onmouseover=\"this.style.color=\'#ffc000\'\" \n\
    onmouseout=\"this.style.color=\'#a9a9a9\'\">Services</button></td><td></td><td align=center>\n\
    <button class=but6 onClick=\"window.location=\'Solutions\'\" onmouseover=\"this.style.color=\'#ffc000\'\" \n\
    onmouseout=\"this.style.color=\'#a9a9a9\'\">Solutions</button></td><td></td><td align=center>\n\
    <button class=but6 onClick=\"window.location=\'Support\'\" onmouseover=\"this.style.color=\'#ffc000\'\" \n\
    onmouseout=\"this.style.color=\'#a9a9a9\'\">Support</button></td><td></td><td align=center>\n\
    <button class=but6 onClick=\"window.location=\'Products\'\" onmouseover=\"this.style.color=\'#ffc000\'\" \n\
    onmouseout=\"this.style.color=\'#a9a9a9\'\">Products</button></td><td></td><td align=center>\n\
    <button class=but6 onClick=\"window.location=\'Contact\'\" onmouseover=\"this.style.color=\'#ffc000\'\" \n\
    onmouseout=\"this.style.color=\'#a9a9a9\'\">Contact Us</button></td><td></td></tr>\n\n\
    </table>\n\n\
    <table width=684px border=0 cellpadding=0 cellspacing=0 summary=content>\n\
    <tr valign=top>\n\
    <td id=AP rowspan=1 class=\"grey2 greyj\" width=198px>\n\
    <div class=mstd>\n\
    <font class=orb>\n\
    Google&#153 challenges you to use YouTube&#153 in new and innovative ways.\n\
    </font><br />\n\
    <font class=norm>\n\
    Embedding widgets and custom players is a quick and easy way to bring YouTube&#153 to your website, \n\
    but if you're looking to have programmatic access, the Data API is the way to go.\n\
    </font>\n\
    </div>\n\n\
    </td>\n\n\
    <td width=288px valign=top align=center style=\"background-color: #222222;\">\n\n\
    <table width=288px bgcolor=#000000 border=0 cellpadding=0 cellspacing=0>\n\n\
    <tr align=center valign=top>\n\n\
    <td align=left>\n\n\
    <button id=uvPWR onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ff0000\'\"\n\
    onclick=\"switchPower(this.id)\">PWR ON</button>\n\
    <td align=center>\n\
    <button id=uv1   onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\"\n\
    onclick=\"changeChannel(this.id)\">1</button>\n\
    <td align=center>\n\
    <button id=uv2   onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\"\n\
    onclick=\"changeChannel(this.id)\">2\n\
    </button>\n\
    <td align=center>\n\
    <button id=uv3   onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\"\n\
    onclick=\"changeChannel(this.id)\">3\n\
    </button>\n\
    <td align=right>\n\
    <button id=uvMUT onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\"\n\
    onclick=\"changeVolume(this.id)\">MUTE\n\
    </button>\n\
    </tr>\n\
    <tr align=center valign=top>\n\
    <td align=left>\n\
    <button id=uvVUP onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\"\n\
    onmousedown=\"this.style.backgroundColor=\'#ff0000\'\" onmouseup=\"this.style.backgroundColor=\'#000000\'\"\n\
    onclick=\"changeVolume(this.id)\">+\n\
    </button>\n\
    <td align=center>\n\
    <button id=uv4   onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\"\n\
    onclick=\"changeChannel(this.id)\">4\n\
    </button>\n\
    <td align=center>\n\
    <button id=uv5   onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\"\n\
    onclick=\"changeChannel(this.id)\">5\n\
    </button>\n\
    <td align=center>\n\
    <button id=uv6   onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\"\n\
    onclick=\"changeChannel(this.id)\">6\n\
    </button>\n\
    <td align=right>\n\
    <button id=uvCUP onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\"\n\
    onmousedown=\"this.style.backgroundColor=\'#ff0000\'\" onmouseup=\"this.style.backgroundColor=\'#000000\'\"\n\
    onclick=\"changeChannel(this.id)\">+\n\
    </button>\n\
    </tr>\n\
    <tr align=center valign=top>\n\
    <td align=center valign=middle>\n\
    VOL\n\
    <td align=center>\n\
    <button id=uv7   onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\"\n\
    onclick=\"changeChannel(this.id)\">7\n\
    </button>\n\
    <td align=center>\n\
    <button id=uv8   onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\"\n\
    onclick=\"changeChannel(this.id)\">8\n\
    </button>\n\
    <td align=center>\n\
    <button id=uv9   onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\"\n\
    onclick=\"changeChannel(this.id)\">9\n\
    </button>\n\
    <td align=center valign=middle>\n\
    CH\n\
    </tr>\n\
    <tr align=center valign=top>\n\
    <td align=left>\n\
    <button id=uvVDN onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\"\n\
    onmousedown=\"this.style.backgroundColor=\'#ff0000\'\" onmouseup=\"this.style.backgroundColor=\'#000000\'\"\n\
    onclick=\"changeVolume(this.id)\">-\n\
    </button>\n\
    <td align=center>\n\
    <button id=uvFAV onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\"\n\
    onmousedown=\"this.style.backgroundColor=\'#ff0000\'\" onmouseup=\"this.style.backgroundColor=\'#000000\'\"\n\
    onclick=\"changeChannel(this.id)\">FAV\n\
    </button>\n\
    <td align=center>\n\
    <button id=uv0   onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\"\n\
    onclick=\"changeChannel(this.id)\">0\n\
    </button>\n\
    <td align=center>\n\
    <button id=uvPRE onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\"\n\
    onmousedown=\"this.style.backgroundColor=\'#ff0000\'\" onmouseup=\"this.style.backgroundColor=\'#000000\'\"\n\
    onclick=\"changeChannel(this.id)\">PRV\n\
    </button>\n\
    <td align=right>\n\
    <button id=uvCDN onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\"\n\
    onmousedown=\"this.style.backgroundColor=\'#ff0000\'\" onmouseup=\"this.style.backgroundColor=\'#000000\'\"\n\
    onclick=\"changeChannel(this.id)\">-\n\
    </button>\n\
    </tr>\n\
    <tr align=center valign=top>\n\
    <td align=left>\n\
    <button id=uvPRG onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\"\n\
    onmousedown=\"this.style.backgroundColor=\'#ff0000\'\" onmouseup=\"this.style.backgroundColor=\'#000000\'\"\n\
    onclick=\"programScope(this.id)\">PROG\n\
    <td align=center>\n\
    <button id=uvBWD onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\"\n\
    onmousedown=\"this.style.backgroundColor=\'#ff0000\'\" onmouseup=\"this.style.backgroundColor=\'#000000\'\"\n\
    onclick=\"changePosition(this.id)\"><<\n\
    </button>\n\
    <td align=center>\n\
    <button id=uvPLY onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\"\n\
    onmousedown=\"this.style.backgroundColor=\'#ff0000\'\" onmouseup=\"this.style.backgroundColor=\'#000000\'\"\n\
    onclick=\"changePosition(this.innerHTML)\">||</button>\n\
    <td align=center>\n\
    <button id=uvFWD onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\"\n\
    onmousedown=\"this.style.backgroundColor=\'#ff0000\'\" onmouseup=\"this.style.backgroundColor=\'#000000\'\"\n\
    onclick=\"changePosition(this.id)\">>>\n\
    </button>\n\
    <td align=right>\n\
    <button id=uvINF onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\"\n\
    onmousedown=\"this.style.backgroundColor=\'#ff0000\'\" onmouseup=\"this.style.backgroundColor=\'#000000\'\"\n\
    onclick=\"changeChannel(this.id)\" value=\"\">INFO\n\
    </tr>\n\
    </table>\n\
    </td>\n\
    <td id=AO class=\"grey3 greyj\" width=198px>\n\
    <div class=mstd>\n\
    <font class=orb>\n\
    Google&#153 encourages you to build monetizable YouTube&#153 applications.\n\
    </font><br />\n\
    <font class=norm>\n\
    The Data API transforms YouTube&#153 into a video Storage Area Network, enabling devices, webapps and desktop applications \n\
    to upload, query and stream content in a completely customized manner.\n\
    </font>\n\
    </div>\n\
    </td>\n\
    </tr>\n\
    </table>"
    #############################################################################
    #youtube_data_api PAGE_MOBILE_LOW_END Generic page for low-end mobile devices
    #############################################################################
    PAGE_MOBILE_LOW_END = "\
    <div class=grey2>\
    <font class=odd>Under </font><font class=url>Construction</font>\
    </div>"
    global DEVICE
    detectDevice()
    if DEVICE == "DESKTOP":
      global PAGE_HEADER_DESKTOP
      PAGE_HEADER_DESKTOP = PAGE_HEADER_DESKTOP.replace("URL IS/IT", "URL IS/IT URLeVision")
      self.response.out.write(PAGE_HEADER_DESKTOP)
      self.response.out.write(URLESCOPE)
      self.response.out.write(PAGE_DESKTOP)
      self.response.out.write(PAGE_FOOTER_DESKTOP)
    if DEVICE == "MOBILE_LOW_END":
      self.response.out.write(PAGE_HEADER_MOBILE_LOW_END)
      self.response.out.write(STYLE_SHEET_MOBILE_LOW_END)
      self.response.out.write(MAIN_MENU_MOBILE_LOW_END)
      self.response.out.write(PAGE_MOBILE_LOW_END)
      self.response.out.write(PAGE_FOOTER_MOBILE_LOW_END)

########################################################################
#urlevision is the server side implementation of the YoutTube_Data_API
########################################################################
class urlevision(webapp.RequestHandler):
  def get(self):
    ###################################################################################################################################
    #Each active URLeScope is identified by their sid (Scope ID) which is also the key to their record in the datastore URLeScope model
    ###################################################################################################################################
    try:
      scope = db.get(db.Key(self.request.get('sid')))
    except:
      self.response.clear()
      self.response.set_status(500)
      self.response.out.write("Operation could not be completed")
    else:
      request = self.request.get('r')
      ####################################################
      #Delete the datatsore record of the signalling scope
      ####################################################
      if request == "C":
        scope.delete()
      #################################################################################################################
      #Return the YouTube vid (Video ID) for the current channel and increment the vid sequence number for that channel
      #################################################################################################################
      if request == "uvFWD":
        if scope.currChannel == 0:
          if scope.uv0seq == len(scope.uv0) - 1:
            scope.uv0seq = 0
          else:
            scope.uv0seq = scope.uv0seq + 1
          self.response.out.write("s={'S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.uv0[scope.uv0seq],scope.uv0name,scope.uv0desc,scope.uv0info[scope.uv0seq]))
          scope.put()
        if scope.currChannel == 1:
          if scope.uv1seq == len(scope.uv1) - 1:
            scope.uv1seq = 0
          else:
            scope.uv1seq = scope.uv1seq + 1
          self.response.out.write("s={'S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.uv1[scope.uv1seq],scope.uv1name,scope.uv1desc,scope.uv1info[scope.uv1seq]))
          scope.put()
        if scope.currChannel == 2:
          if scope.uv2seq == len(scope.uv2) - 1:
            scope.uv2seq = 0
          else:
            scope.uv2seq = scope.uv2seq + 1
          self.response.out.write("s={'S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.uv2[scope.uv2seq],scope.uv2name,scope.uv2desc,scope.uv2info[scope.uv2seq]))
          scope.put()
        if scope.currChannel == 3:
          if scope.uv3seq == len(scope.uv3) - 1:
            scope.uv3seq = 0
          else:
            scope.uv3seq = scope.uv3seq + 1
          self.response.out.write("s={'S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.uv3[scope.uv3seq],scope.uv3name,scope.uv3desc,scope.uv3info[scope.uv3seq]))
          scope.put()
        if scope.currChannel == 4:
          if scope.uv4seq == len(scope.uv4) - 1:
            scope.uv4seq = 0
          else:
            scope.uv4seq = scope.uv4seq + 1
          self.response.out.write("s={'S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.uv4[scope.uv4seq],scope.uv4name,scope.uv4desc,scope.uv4info[scope.uv4seq]))
          scope.put()
        if scope.currChannel == 5:
          if scope.uv5seq == len(scope.uv5) - 1:
            scope.uv5seq = 0
          else:
            scope.uv5seq = scope.uv5seq + 1
          self.response.out.write("s={'S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.uv5[scope.uv5seq],scope.uv5name,scope.uv5desc,scope.uv5info[scope.uv5seq]))
          scope.put()
        if scope.currChannel == 6:
          if scope.uv6seq == len(scope.uv6) - 1:
            scope.uv6seq = 0
          else:
            scope.uv6seq = scope.uv6seq + 1
          self.response.out.write("s={'S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.uv6[scope.uv6seq],scope.uv6name,scope.uv6desc,scope.uv6info[scope.uv6seq]))
          scope.put()
        if scope.currChannel == 7:
          if scope.uv7seq == len(scope.uv7) - 1:
            scope.uv7seq = 0
          else:
            scope.uv7seq = scope.uv7seq + 1
          self.response.out.write("s={'S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.uv7[scope.uv7seq],scope.uv7name,scope.uv7desc,scope.uv7info[scope.uv7seq]))
          scope.put()
        if scope.currChannel == 8:
          if scope.uv8seq == len(scope.uv8) - 1:
            scope.uv8seq = 0
          else:
            scope.uv8seq = scope.uv8seq + 1
          self.response.out.write("s={'S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.uv8[scope.uv8seq],scope.uv8name,scope.uv8desc,scope.uv8info[scope.uv8seq]))
          scope.put()
        if scope.currChannel == 9:
          if scope.uv9seq == len(scope.uv9) - 1:
            scope.uv9seq = 0
          else:
            scope.uv9seq = scope.uv9seq + 1
          self.response.out.write("s={'S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.uv9[scope.uv9seq],scope.uv9name,scope.uv9desc,scope.uv9info[scope.uv9seq]))
          scope.put()
      ##########################################################################################################################
      #Skip backwards to the previous YouTube vid for the current channel and decrement the vid sequence number for that channel
      ##########################################################################################################################
      if request == "uvBWD":
        if scope.currChannel == 0:
          if scope.uv0seq == 0:
            scope.uv0seq = len(scope.uv0) - 1
          else:
            scope.uv0seq = scope.uv0seq - 1
          self.response.out.write("s={'S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.uv0[scope.uv0seq],scope.uv0name,scope.uv0desc,scope.uv0info[scope.uv0seq]))
          scope.put()
        if scope.currChannel == 1:
          if scope.uv1seq == 0:
            scope.uv1seq = len(scope.uv1) - 1
          else:
            scope.uv1seq = scope.uv1seq - 1
          self.response.out.write("s={'S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.uv1[scope.uv1seq],scope.uv1name,scope.uv1desc,scope.uv1info[scope.uv1seq]))
          scope.put()
        if scope.currChannel == 2:
          if scope.uv2seq == 0:
            scope.uv2seq = len(scope.uv2) - 1
          else:
            scope.uv2seq = scope.uv2seq - 1
          self.response.out.write("s={'S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.uv2[scope.uv2seq],scope.uv2name,scope.uv2desc,scope.uv2info[scope.uv2seq]))
          scope.put()
        if scope.currChannel == 3:
          if scope.uv3seq == 0:
            scope.uv3seq = len(scope.uv3) - 1
          else:
            scope.uv3seq = scope.uv3seq - 1
          self.response.out.write("s={'S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.uv3[scope.uv3seq],scope.uv3name,scope.uv3desc,scope.uv3info[scope.uv3seq]))
          scope.put()
        if scope.currChannel == 4:
          if scope.uv4seq == 0:
            scope.uv4seq = len(scope.uv4) - 1
          else:
            scope.uv4seq = scope.uv4seq - 1
          self.response.out.write("s={'S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.uv4[scope.uv4seq],scope.uv4name,scope.uv4desc,scope.uv4info[scope.uv4seq]))
          scope.put()
        if scope.currChannel == 5:
          if scope.uv5seq == 0:
            scope.uv5seq = len(scope.uv5) - 1
          else:
            scope.uv5seq = scope.uv5seq - 1
          self.response.out.write("s={'S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.uv5[scope.uv5seq],scope.uv5name,scope.uv5desc,scope.uv5info[scope.uv5seq]))
          scope.put()
        if scope.currChannel == 6:
          if scope.uv6seq == 0:
            scope.uv6seq = len(scope.uv6) - 1
          else:
            scope.uv6seq = scope.uv6seq - 1
          self.response.out.write("s={'S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.uv6[scope.uv6seq],scope.uv6name,scope.uv6desc,scope.uv6info[scope.uv6seq]))
          scope.put()
        if scope.currChannel == 7:
          if scope.uv7seq == 0:
            scope.uv7seq = len(scope.uv7) - 1
          else:
            scope.uv7seq = scope.uv7seq - 1
          self.response.out.write("s={'S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.uv7[scope.uv7seq],scope.uv7name,scope.uv7desc,scope.uv7info[scope.uv7seq]))
          scope.put()
        if scope.currChannel == 8:
          if scope.uv8seq == 0:
            scope.uv8seq = len(scope.uv8) - 1
          else:
            scope.uv8seq = scope.uv8seq - 1
          self.response.out.write("s={'S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.uv8[scope.uv8seq],scope.uv8name,scope.uv8desc,scope.uv8info[scope.uv8seq]))
          scope.put()
        if scope.currChannel == 9:
          if scope.uv9seq == len(scope.uv9) - 1:
            scope.uv9seq = 0
          else:
            scope.uv9seq = scope.uv9seq + 1
          self.response.out.write("s={'S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.uv9[scope.uv9seq],scope.uv9name,scope.uv9desc,scope.uv9info[scope.uv9seq]))
          scope.put()
      ###################################################
      #Change the current channel to the signaled channel
      ###################################################
      if request == "uv0":
        scope.prevChannel = scope.currChannel
        scope.currChannel = 0
        self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
        (scope.currChannel,scope.prevChannel,scope.uv0[scope.uv0seq],scope.uv0name,scope.uv0desc,scope.uv0info[scope.uv0seq]))
        scope.put()
      if request == "uv1":
        scope.prevChannel = scope.currChannel
        scope.currChannel = 1
        self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
        (scope.currChannel,scope.prevChannel,scope.uv1[scope.uv1seq],scope.uv1name,scope.uv1desc,scope.uv1info[scope.uv1seq]))
        scope.put()
      if request == "uv2":
        scope.prevChannel = scope.currChannel
        scope.currChannel = 2
        self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
        (scope.currChannel,scope.prevChannel,scope.uv2[scope.uv2seq],scope.uv2name,scope.uv2desc,scope.uv2info[scope.uv2seq]))
        scope.put()
      if request == "uv3":
        scope.prevChannel = scope.currChannel
        scope.currChannel = 3
        self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
        (scope.currChannel,scope.prevChannel,scope.uv3[scope.uv3seq],scope.uv3name,scope.uv3desc,scope.uv3info[scope.uv3seq]))
        scope.put()
      if request == "uv4":
        scope.prevChannel = scope.currChannel
        scope.currChannel = 4
        self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
        (scope.currChannel,scope.prevChannel,scope.uv4[scope.uv4seq],scope.uv4name,scope.uv4desc,scope.uv4info[scope.uv4seq]))
        scope.put()
      if request == "uv5":
        scope.prevChannel = scope.currChannel
        scope.currChannel = 5
        self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
        (scope.currChannel,scope.prevChannel,scope.uv5[scope.uv5seq],scope.uv5name,scope.uv5desc,scope.uv5info[scope.uv5seq]))
        scope.put()
      if request == "uv6":
        scope.prevChannel = scope.currChannel
        scope.currChannel = 6
        self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
        (scope.currChannel,scope.prevChannel,scope.uv6[scope.uv6seq],scope.uv6name,scope.uv6desc,scope.uv6info[scope.uv6seq]))
        scope.put()
      if request == "uv7":
        scope.prevChannel = scope.currChannel
        scope.currChannel = 7
        self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
        (scope.currChannel,scope.prevChannel,scope.uv7[scope.uv7seq],scope.uv7name,scope.uv7desc,scope.uv7info[scope.uv7seq]))
        scope.put()
      if request == "uv8":
        scope.prevChannel = scope.currChannel
        scope.currChannel = 8
        self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
        (scope.currChannel,scope.prevChannel,scope.uv8[scope.uv8seq],scope.uv8name,scope.uv8desc,scope.uv8info[scope.uv8seq]))
        scope.put()
      if request == "uv9":
        scope.prevChannel = scope.currChannel
        scope.currChannel = 9
        self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
        (scope.currChannel,scope.prevChannel,scope.uv9[scope.uv9seq],scope.uv9name,scope.uv9desc,scope.uv9info[scope.uv9seq]))
        scope.put()
      ##################################################
      #Change the current channel to the next/Up channel
      ##################################################
      if request == "uvCUP":
        scope.prevChannel = scope.currChannel
        if scope.currChannel == 0:
          scope.currChannel = 1
          self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.currChannel,scope.prevChannel,scope.uv1[scope.uv1seq],scope.uv1name,scope.uv1desc,scope.uv1info[scope.uv1seq]))
        elif scope.currChannel == 1:
          scope.currChannel = 2
          self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.currChannel,scope.prevChannel,scope.uv2[scope.uv2seq],scope.uv2name,scope.uv2desc,scope.uv2info[scope.uv2seq]))
        elif scope.currChannel == 2:
          scope.currChannel = 3
          self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.currChannel,scope.prevChannel,scope.uv3[scope.uv3seq],scope.uv3name,scope.uv3desc,scope.uv3info[scope.uv3seq]))
        elif scope.currChannel == 3:
          scope.currChannel = 4
          self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.currChannel,scope.prevChannel,scope.uv4[scope.uv4seq],scope.uv4name,scope.uv4desc,scope.uv4info[scope.uv4seq]))
        elif scope.currChannel == 4:
          scope.currChannel = 5
          self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.currChannel,scope.prevChannel,scope.uv5[scope.uv5seq],scope.uv5name,scope.uv5desc,scope.uv5info[scope.uv5seq]))
        elif scope.currChannel == 5:
          scope.currChannel = 6
          self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.currChannel,scope.prevChannel,scope.uv6[scope.uv6seq],scope.uv6name,scope.uv6desc,scope.uv6info[scope.uv6seq]))
        elif scope.currChannel == 6:
          scope.currChannel = 7
          self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.currChannel,scope.prevChannel,scope.uv7[scope.uv7seq],scope.uv7name,scope.uv7desc,scope.uv7info[scope.uv7seq]))
        elif scope.currChannel == 7:
          scope.currChannel = 8
          self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.currChannel,scope.prevChannel,scope.uv8[scope.uv8seq],scope.uv8name,scope.uv8desc,scope.uv8info[scope.uv8seq]))
        elif scope.currChannel == 8:
          scope.currChannel = 9
          self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.currChannel,scope.prevChannel,scope.uv9[scope.uv9seq],scope.uv9name,scope.uv9desc,scope.uv9info[scope.uv9seq]))
        elif scope.currChannel == 9:
          scope.currChannel = 0
          self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.currChannel,scope.prevChannel,scope.uv0[scope.uv0seq],scope.uv0name,scope.uv0desc,scope.uv0info[scope.uv0seq]))
        scope.put()
      ########################################################
      #Change the current channel to the previous/down channel
      ########################################################
      if request == "uvCDN":
        scope.prevChannel = scope.currChannel
        if scope.currChannel == 9:
          scope.currChannel = 8
          self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.currChannel,scope.prevChannel,scope.uv8[scope.uv8seq],scope.uv8name,scope.uv8desc,scope.uv8info[scope.uv8seq]))
        elif scope.currChannel == 8:
          scope.currChannel = 7
          self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.currChannel,scope.prevChannel,scope.uv7[scope.uv7seq],scope.uv7name,scope.uv7desc,scope.uv7info[scope.uv7seq]))
        elif scope.currChannel == 7:
          scope.currChannel = 6
          self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.currChannel,scope.prevChannel,scope.uv6[scope.uv6seq],scope.uv6name,scope.uv6desc,scope.uv6info[scope.uv6seq]))
        elif scope.currChannel == 6:
          scope.currChannel = 5
          self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.currChannel,scope.prevChannel,scope.uv5[scope.uv5seq],scope.uv5name,scope.uv5desc,scope.uv5info[scope.uv5seq]))
        elif scope.currChannel == 5:
          scope.currChannel = 4
          self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.currChannel,scope.prevChannel,scope.uv4[scope.uv4seq],scope.uv4name,scope.uv4desc,scope.uv4info[scope.uv4seq]))
        elif scope.currChannel == 4:
          scope.currChannel = 3
          self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.currChannel,scope.prevChannel,scope.uv3[scope.uv3seq],scope.uv3name,scope.uv3desc,scope.uv3info[scope.uv3seq]))
        elif scope.currChannel == 3:
          scope.currChannel = 2
          self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.currChannel,scope.prevChannel,scope.uv2[scope.uv2seq],scope.uv2name,scope.uv2desc,scope.uv2info[scope.uv2seq]))
        elif scope.currChannel == 2:
          scope.currChannel = 1
          self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.currChannel,scope.prevChannel,scope.uv1[scope.uv1seq],scope.uv1name,scope.uv1desc,scope.uv1info[scope.uv1seq]))
        elif scope.currChannel == 1:
          scope.currChannel = 0
          self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.currChannel,scope.prevChannel,scope.uv0[scope.uv0seq],scope.uv0name,scope.uv0desc,scope.uv0info[scope.uv0seq]))
        elif scope.currChannel == 0:
          scope.currChannel = 9
          self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.currChannel,scope.prevChannel,scope.uv9[scope.uv9seq],scope.uv9name,scope.uv9desc,scope.uv9info[scope.uv9seq]))
        scope.put()
      ###################################################
      #Change the current channel to the previous channel
      ###################################################
      if request == "uvPRE":
        x = scope.currChannel
        scope.currChannel = scope.prevChannel
        scope.prevChannel = x
        if scope.currChannel == 0:
          self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.currChannel,scope.prevChannel,scope.uv0[scope.uv0seq],scope.uv0name,scope.uv0desc,scope.uv0info[scope.uv0seq]))
        elif scope.currChannel == 1:
          self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.currChannel,scope.prevChannel,scope.uv1[scope.uv1seq],scope.uv1name,scope.uv1desc,scope.uv1info[scope.uv1seq]))
        elif scope.currChannel == 2:
          self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.currChannel,scope.prevChannel,scope.uv2[scope.uv2seq],scope.uv2name,scope.uv2desc,scope.uv2info[scope.uv2seq]))
        elif scope.currChannel == 3:
          self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.currChannel,scope.prevChannel,scope.uv3[scope.uv3seq],scope.uv3name,scope.uv3desc,scope.uv3info[scope.uv3seq]))
        elif scope.currChannel == 4:
          self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.currChannel,scope.prevChannel,scope.uv3[scope.uv3seq],scope.uv3name,scope.uv3desc,scope.uv3info[scope.uv3seq]))
        elif scope.currChannel == 5:
          self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.currChannel,scope.prevChannel,scope.uv5[scope.uv5seq],scope.uv5name,scope.uv5desc,scope.uv5info[scope.uv5seq]))
        elif scope.currChannel == 6:
          self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.currChannel,scope.prevChannel,scope.uv6[scope.uv6seq],scope.uv6name,scope.uv6desc,scope.uv6info[scope.uv6seq]))
        elif scope.currChannel == 7:
          self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.currChannel,scope.prevChannel,scope.uv7[scope.uv7seq],scope.uv7name,scope.uv7desc,scope.uv7info[scope.uv7seq]))
        elif scope.currChannel == 8:
          self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.currChannel,scope.prevChannel,scope.uv8[scope.uv8seq],scope.uv8name,scope.uv8desc,scope.uv8info[scope.uv8seq]))
        elif scope.currChannel == 9:
          self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.currChannel,scope.prevChannel,scope.uv9[scope.uv9seq],scope.uv9name,scope.uv9desc,scope.uv9info[scope.uv9seq]))
        scope.put()
      ##################################################
      #Change the current channel to programmed favorite
      ##################################################
      if request == "uvFAV":
        scope.prevChannel = scope.currChannel
        scope.currChannel = scope.favChannel
        if scope.currChannel == 0:
          self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.currChannel,scope.prevChannel,scope.uv0[scope.uv0seq],scope.uv0name,scope.uv0desc,scope.uv0info[scope.uv0seq]))
        elif scope.currChannel == 1:
          self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.currChannel,scope.prevChannel,scope.uv1[scope.uv1seq],scope.uv1name,scope.uv1desc,scope.uv1info[scope.uv1seq]))
        elif scope.currChannel == 2:
          self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.currChannel,scope.prevChannel,scope.uv2[scope.uv2seq],scope.uv2name,scope.uv2desc,scope.uv2info[scope.uv2seq]))
        elif scope.currChannel == 3:
          self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.currChannel,scope.prevChannel,scope.uv3[scope.uv3seq],scope.uv3name,scope.uv3desc,scope.uv3info[scope.uv3seq]))
        elif scope.currChannel == 4:
          self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.currChannel,scope.prevChannel,scope.uv4[scope.uv4seq],scope.uv4name,scope.uv4desc,scope.uv4info[scope.uv4seq]))
        elif scope.currChannel == 5:
          self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.currChannel,scope.prevChannel,scope.uv5[scope.uv5seq],scope.uv5name,scope.uv5desc,scope.uv5info[scope.uv5seq]))
        elif scope.currChannel == 6:
          self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.currChannel,scope.prevChannel,scope.uv6[scope.uv6seq],scope.uv6name,scope.uv6desc,scope.uv6info[scope.uv6seq]))
        elif scope.currChannel == 7:
          self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.currChannel,scope.prevChannel,scope.uv7[scope.uv7seq],scope.uv7name,scope.uv7desc,scope.uv7info[scope.uv7seq]))
        elif scope.currChannel == 8:
          self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.currChannel,scope.prevChannel,scope.uv8[scope.uv8seq],scope.uv8name,scope.uv8desc,scope.uv8info[scope.uv8seq]))
        elif scope.currChannel == 9:
          self.response.out.write("c={'C':'%s','P':'%s','S':'%s','N':'%s','D':'%s','I':'%s'}"%\
          (scope.currChannel,scope.prevChannel,scope.uv9[scope.uv9seq],scope.uv9name,scope.uv9desc,scope.uv9info[scope.uv9seq]))
        scope.put()
      #########################################################
      #Returns the current channel name and description as JSON
      #########################################################
      if request == "uvINF":
        if scope.currChannel == 0:
          self.response.out.write("i={'N':'%s','D':'%s','I':'%s'}"%(scope.uv0name,scope.uv0desc,scope.uv0info[scope.uv0seq]))
        if scope.currChannel == 1:
          self.response.out.write("i = {\"N\":\"%s\",\"D\":\"%s\",\"I\":\"%s\"}" % (scope.uv1name, scope.uv1desc, scope.uv1info[scope.uv1seq]))
        if scope.currChannel == 2:
          self.response.out.write("i = {\"N\":\"%s\",\"D\":\"%s\",\"I\":\"%s\"}" % (scope.uv2name, scope.uv2desc, scope.uv2info[scope.uv2seq]))
        if scope.currChannel == 3:
          self.response.out.write("i = {\"N\":\"%s\",\"D\":\"%s\",\"I\":\"%s\"}" % (scope.uv3name, scope.uv3desc, scope.uv3info[scope.uv3seq]))
        if scope.currChannel == 4:
          self.response.out.write("i = {\"N\":\"%s\",\"D\":\"%s\",\"I\":\"%s\"}" % (scope.uv4name, scope.uv4desc, scope.uv4info[scope.uv4seq]))
        if scope.currChannel == 5:
          self.response.out.write("i = {\"N\":\"%s\",\"D\":\"%s\",\"I\":\"%s\"}" % (scope.uv5name, scope.uv5desc, scope.uv5info[scope.uv5seq]))
        if scope.currChannel == 6:
          self.response.out.write("i = {\"N\":\"%s\",\"D\":\"%s\",\"I\":\"%s\"}" % (scope.uv6name, scope.uv6desc, scope.uv6info[scope.uv6seq]))
        if scope.currChannel == 7:
          self.response.out.write("i = {\"N\":\"%s\",\"D\":\"%s\",\"I\":\"%s\"}" % (scope.uv7name, scope.uv7desc, scope.uv7info[scope.uv7seq]))
        if scope.currChannel == 8:
          self.response.out.write("i = {\"N\":\"%s\",\"D\":\"%s\",\"I\":\"%s\"}" % (scope.uv8name, scope.uv8desc, scope.uv8info[scope.uv8seq]))
        if scope.currChannel == 9:
          self.response.out.write("i = {\"N\":\"%s\",\"D\":\"%s\",\"I\":\"%s\"}" % (scope.uv9name, scope.uv9desc, scope.uv9info[scope.uv9seq]))
      #############################################################################################
      #Receives the programming selection and returns new menu based on value of category and depth
      #############################################################################################
      if request == "uvPRG" and scope.progScope == 0:
        channel   = self.request.get('channel')
        memcache.set(self.request.get('sid'), channel[2])
        if channel == "uvFAV":
          scope.progScope = -1
          scope.put()
        else:
          scope.progScope = 1
          scope.put()
          self.response.out.write("p = {\"l\":5,\"m\":[\"Standard feeds\",\
                                                       \"Specific User feeds\",\
                                                       \"Users Favorites feeds\",\
                                                       \"User Subscriptions feeds\",\
                                                       \"Category feeds\",\
                                                       \"Query (search) feeds\"]}")
      elif request == "uvPRG" and scope.progScope == -1:
        selection = self.request.get('selection')
        scope.progScope = 0
        scope.favChannel = int(selection[2])
        scope.put()
        self.response.out.write("p = {\"l\":0,\"m\":[\"Press <font color=black>PROG</font> to complete channel programming\"]}")
      elif request == "uvPRG" and scope.progScope == 1:
        direction = self.request.get('direction')
        selection = self.request.get('selection')
        if direction == "uvFWD" and selection == "0":
          scope.progScope = 2
          scope.put()
          self.response.out.write("p = {\"l\":7,\"m\":[\"Top rated\",\
                                                       \"Top favorites\",\
                                                       \"Most viewed\",\
                                                       \"Most popular\",\
                                                       \"Most recent\",\
                                                       \"Most discussed\",\
                                                       \"Most responded\",\
                                                       \"Recently featured\"]}")
        #########################################
        #SELECTION COMPLETED>1 Specific User feed
        #########################################
        if direction == "uvFWD" and selection == "1":
          scope.progScope = 2
          scope.put()
          self.response.out.write("p = {\"l\":0,\"m\":[\"SELECTION COMPLETED>Specific User feed\"]}")
        ############################################
        #SELECTION COMPLETED>2 Users Favorites feeds
        ############################################
        if direction == "uvFWD" and selection == "2":
          scope.progScope = 2
          scope.put()
          self.response.out.write("p = {\"l\":0,\"m\":[\"SELECTION COMPLETED>Users Favorites feeds\"]}")
        ###############################################
        #SELECTION COMPLETED>3 User Subscriptions feeds
        ###############################################
        if direction == "uvFWD" and selection == "3":
          scope.progScope = 2
          scope.put()
          self.response.out.write("p = {\"l\":0,\"m\":[\"SELECTION COMPLETED>User Subscriptions feeds\"]}")
        if direction == "uvFWD" and selection == "4":
          scope.progScope = 2
          scope.put()
          self.response.out.write("p = {\"l\":14,\"m\":[\"Film & Animation\",\
                                                       \"Autos & Vehicles\",\
                                                       \"Music\",\
                                                       \"Pets & Animals\",\
                                                       \"Sports\",\
                                                       \"Travel & Events\",\
                                                       \"Gaming\",\
                                                       \"Comedy\",\
                                                       \"People & Blogs\",\
                                                       \"News & Politics\",\
                                                       \"Entertainment\",\
                                                       \"Education\",\
                                                       \"Howto & Style\",\
                                                       \"Non-Profits & Activism\",\
                                                       \"Science & Technology\"]}")
        ##########################################
        #SELECTION COMPLETED>5 Query (search feeds
        ##########################################
        if direction == "uvFWD" and selection == "5":
          scope.progScope = 2
          scope.put()
          self.response.out.write("p = {\"l\":0,\"m\":[\"SELECTION COMPLETED>Query (search) feeds\"]}")
      elif request == "uvPRG" and scope.progScope == 2:
        direction = self.request.get('direction')
        selection = self.request.get('selection')
        if direction == "uvBWD":
          scope.progScope = 1
          scope.put()
          self.response.out.write("p = {\"l\":5,\"m\":[\"Standard feeds\",\
                                                       \"Specific User feeds\",\
                                                       \"Users Favorites feeds\",\
                                                       \"User Subscriptions feeds\",\
                                                       \"Category feeds\",\
                                                       \"Query (search) feeds\"]}")
        if direction == "uvFWD" and selection == "0":
          scope.progScope = 3
          scope.put()
          self.response.out.write("p = {\"l\":22,\"m\":[\"Australia\",\
                                                       \"Brazil\",\
                                                       \"Canada\",\
                                                       \"Czech Republic\",\
                                                       \"France\",\
                                                       \"Germany\",\
                                                       \"Great Britain\",\
                                                       \"Holland\",\
                                                       \"Hong Kong\",\
                                                       \"India\",\
                                                       \"Ireland\",\
                                                       \"Israel\",\
                                                       \"Italy\",\
                                                       \"Japan\",\
                                                       \"Mexico\",\
                                                       \"New Zealand\",\
                                                       \"Poland\",\
                                                       \"Russia\",\
                                                       \"South Korea\",\
                                                       \"Spain\",\
                                                       \"Sweden\",\
                                                       \"Taiwan\",\
                                                       \"United States\"]}")
      elif request == "uvPRG" and scope.progScope == 3:
        direction = self.request.get('direction')
        selection = self.request.get('selection')
        if direction == "uvBWD":
          scope.progScope = 2
          scope.put()
          self.response.out.write("p = {\"l\":7,\"m\":[\"Top rated\",\
                                                       \"Top favorites\",\
                                                       \"Most viewed\",\
                                                       \"Most popular\",\
                                                       \"Most recent\",\
                                                       \"Most discussed\",\
                                                       \"Most responded\",\
                                                       \"Recently featured\"]}")

        #############################################################
        #SELECTION COMPLETED>0 Standard feeds>0 Top rated>0 Australia
        #############################################################
        if direction == "uvFWD" and selection == "0":
          scope.progScope = 0
          scope.put()
          sid         = self.request.get('sid')
          name        = self.request.get('n')
          description = self.request.get('d')
          taskqueue.add(url='/URLeProgram', params={'sid': sid,'feedtype':'standardfeeds','feedcategory':'top_rated','local':'1','name': name, 'description': description}, method='GET')
          self.response.out.write("p = {\"l\":0,\"m\":[\"Press <font color=black>PROG</font> to complete channel programming\"]}")
        ##########################################################
        #SELECTION COMPLETED>0 Standard feeds>0 Top rated>1 Brazil
        ##########################################################
        if direction == "uvFWD" and selection == "1":
          scope.progScope = 4
          scope.put()
          self.response.out.write("p = {\"l\":0,\"m\":[\"SELECTION COMPLETED>Standard feeds>Top rated>Brazil\"]}")
        ##########################################################
        #SELECTION COMPLETED>0 Standard feeds>0 Top rated>2 Canada
        ##########################################################
        if direction == "uvFWD" and selection == "2":
          scope.progScope = 4
          scope.put()
          self.response.out.write("p = {\"l\":0,\"m\":[\"SELECTION COMPLETED>Standard feeds>Top rated>Canada\"]}")
        ##################################################################
        #SELECTION COMPLETED>0 Standard feeds>0 Top rated>3 Czech Republic
        ##################################################################
        if direction == "uvFWD" and selection == "3":
          scope.progScope = 4
          scope.put()
          self.response.out.write("p = {\"l\":0,\"m\":[\"SELECTION COMPLETED>Standard feeds>Top rated>Czech Republic\"]}")
        ##########################################################
        #SELECTION COMPLETED>0 Standard feeds>0 Top rated>4 France
        ##########################################################
        if direction == "uvFWD" and selection == "4":
          scope.progScope = 4
          scope.put()
          self.response.out.write("p = {\"l\":0,\"m\":[\"SELECTION COMPLETED>Standard feeds>Top rated>France\"]}")
        ###########################################################
        #SELECTION COMPLETED>0 Standard feeds>0 Top rated>5 Germany
        ###########################################################
        if direction == "uvFWD" and selection == "5":
          scope.progScope = 4
          scope.put()
          self.response.out.write("p = {\"l\":0,\"m\":[\"SELECTION COMPLETED>Standard feeds>Top rated>Germany\"]}")
        #################################################################
        #SELECTION COMPLETED>0 Standard feeds>0 Top rated>6 Great Britain
        #################################################################
        if direction == "uvFWD" and selection == "6":
          scope.progScope = 4
          scope.put()
          self.response.out.write("p = {\"l\":0,\"m\":[\"SELECTION COMPLETED>Standard feeds>Top rated>Great Britain\"]}")
        ###########################################################
        #SELECTION COMPLETED>0 Standard feeds>0 Top rated>7 Holland
        ###########################################################
        if direction == "uvFWD" and selection == "7":
          scope.progScope = 4
          scope.put()
          self.response.out.write("p = {\"l\":0,\"m\":[\"SELECTION COMPLETED>Standard feeds>Top rated>Holland\"]}")
        #############################################################
        #SELECTION COMPLETED>0 Standard feeds>0 Top rated>8 Hong Kong
        #############################################################
        if direction == "uvFWD" and selection == "8":
          scope.progScope = 4
          scope.put()
          self.response.out.write("p = {\"l\":0,\"m\":[\"SELECTION COMPLETED>Standard feeds>Top rated>Hong Kong\"]}")
        #########################################################
        #SELECTION COMPLETED>0 Standard feeds>0 Top rated>9 India
        #########################################################
        if direction == "uvFWD" and selection == "9":
          scope.progScope = 4
          scope.put()
          self.response.out.write("p = {\"l\":0,\"m\":[\"SELECTION COMPLETED>Standard feeds>Top rated>India\"]}")
        ############################################################
        #SELECTION COMPLETED>0 Standard feeds>0 Top rated>10 Ireland
        ############################################################
        if direction == "uvFWD" and selection == "10":
          scope.progScope = 4
          scope.put()
          self.response.out.write("p = {\"l\":0,\"m\":[\"SELECTION COMPLETED>Standard feeds>Top rated>Ireland\"]}")
        ###########################################################
        #SELECTION COMPLETED>0 Standard feeds>0 Top rated>11 Israel
        ###########################################################
        if direction == "uvFWD" and selection == "11":
          scope.progScope = 4
          scope.put()
          self.response.out.write("p = {\"l\":0,\"m\":[\"SELECTION COMPLETED>Standard feeds>Top rated>Israel\"]}")
        ##########################################################
        #SELECTION COMPLETED>0 Standard feeds>0 Top rated>12 Italy
        ##########################################################
        if direction == "uvFWD" and selection == "12":
          scope.progScope = 4
          scope.put()
          self.response.out.write("p = {\"l\":0,\"m\":[\"SELECTION COMPLETED>Standard feeds>Top rated>Italy\"]}")
        ##########################################################
        #SELECTION COMPLETED>0 Standard feeds>0 Top rated>13 Japan
        ##########################################################
        if direction == "uvFWD" and selection == "13":
          scope.progScope = 4
          scope.put()
          self.response.out.write("p = {\"l\":0,\"m\":[\"SELECTION COMPLETED>Standard feeds>Top rated>Japan\"]}")
        ###########################################################
        #SELECTION COMPLETED>0 Standard feeds>0 Top rated>14 Mexico
        ###########################################################
        if direction == "uvFWD" and selection == "14":
          scope.progScope = 4
          scope.put()
          self.response.out.write("p = {\"l\":0,\"m\":[\"SELECTION COMPLETED>Standard feeds>Top rated>Mexico\"]}")
        ################################################################
        #SELECTION COMPLETED>0 Standard feeds>0 Top rated>15 New Zealand
        ################################################################
        if direction == "uvFWD" and selection == "15":
          scope.progScope = 4
          scope.put()
          self.response.out.write("p = {\"l\":0,\"m\":[\"SELECTION COMPLETED>Standard feeds>Top rated>New Zealand\"]}")
        ###########################################################
        #SELECTION COMPLETED>0 Standard feeds>0 Top rated>16 Poland
        ###########################################################
        if direction == "uvFWD" and selection == "16":
          scope.progScope = 4
          scope.put()
          self.response.out.write("p = {\"l\":0,\"m\":[\"SELECTION COMPLETED>Standard feeds>Top rated>Poland\"]}")
        ###########################################################
        #SELECTION COMPLETED>0 Standard feeds>0 Top rated>17 Russia
        ###########################################################
        if direction == "uvFWD" and selection == "17":
          scope.progScope = 4
          scope.put()
          self.response.out.write("p = {\"l\":0,\"m\":[\"SELECTION COMPLETED>Standard feeds>Top rated>Russia\"]}")
        ################################################################
        #SELECTION COMPLETED>0 Standard feeds>0 Top rated>18 South Korea
        ################################################################
        if direction == "uvFWD" and selection == "18":
          scope.progScope = 4
          scope.put()
          self.response.out.write("p = {\"l\":0,\"m\":[\"SELECTION COMPLETED>Standard feeds>Top rated>South Korea\"]}")
        ##########################################################
        #SELECTION COMPLETED>0 Standard feeds>0 Top rated>19 Spain
        ##########################################################
        if direction == "uvFWD" and selection == "19":
          scope.progScope = 4
          scope.put()
          self.response.out.write("p = {\"l\":0,\"m\":[\"SELECTION COMPLETED>Standard feeds>Top rated>Spain\"]}")
        ###########################################################
        #SELECTION COMPLETED>0 Standard feeds>0 Top rated>20 Sweden
        ###########################################################
        if direction == "uvFWD" and selection == "20":
          scope.progScope = 4
          scope.put()
          self.response.out.write("p = {\"l\":0,\"m\":[\"SELECTION COMPLETED>Standard feeds>Top rated>Sweden\"]}")
        ###########################################################
        #SELECTION COMPLETED>0 Standard feeds>0 Top rated>21 Taiwan
        ###########################################################
        if direction == "uvFWD" and selection == "21":
          scope.progScope = 4
          scope.put()
          self.response.out.write("p = {\"l\":0,\"m\":[\"SELECTION COMPLETED>Standard feeds>Top rated>Taiwan\"]}")
        ##################################################################
        #SELECTION COMPLETED>0 Standard feeds>0 Top rated>22 United States
        ##################################################################
        if direction == "uvFWD" and selection == "22":
          scope.progScope = 4
          scope.put()
          self.response.out.write("p = {\"l\":0,\"m\":[\"SELECTION COMPLETED>Standard feeds>Top rated>United States\"]}")

###########################################################
#env displays environment variable available to python wsgi
###########################################################
class env(webapp.RequestHandler):
  def get(self):
    for name in os.environ.keys():
      self.response.out.write("%s = %s<br />\n" % (name, os.environ[name]))
    self.response.out.write("REMOTE_ADDR = %s<br />\n" % os.environ["REMOTE_ADDR"])

#############################################################
#testharness is a dummy class which impliments a minimal page
#############################################################
class testharness(webapp.RequestHandler):
  def get(self):
    self.response.out.write(PAGE_HEADER_DESKTOP)
    self.response.out.write(STYLE_SHEET_DESKTOP)
    self.response.out.write(MAIN_MENU_DESKTOP)
    self.response.out.write("<table width=684 border=0 cellpadding=0 cellspacing=0 summary=content><tr valign=top>\n")
    self.response.out.write("<tr>")
    self.response.out.write("<td class=\"grey2 greyj\" width=342>")
    self.response.out.write("<div class=mdig>")
    self.response.out.write("<font class=odd>Test </font><font class=url>Utilities</font>")
    self.response.out.write("<td class=\"grey3 greyj\" width=342>")
    self.response.out.write("<div class=msmall0>")
    self.response.out.write("<font class=odd>Test </font><font class=url>Cases</font>")
    self.response.out.write("</tr>")
    self.response.out.write("<td colspan=2 class=grey1 width=684>")
    self.response.out.write("<div class=msmall0>")
    self.response.out.write("<font class=odd>YouTube Data API</font><font class=url> Request</font>")
    self.response.out.write("<form action=/FooTube_Data_API_Query_Generator method=post>\n")
    self.response.out.write("<button type=submit id=f name=feed_request \n")
    self.response.out.write("style=\"height:20;font-size:10;background-color:#222222;color:#ffffff;cursor:pointer;font-weight:bold;\" \n")
    self.response.out.write("onmouseover=\"this.style.color=\'#ffc000\'\" onmouseout=\"this.style.color=\'#ffffff\'\" value=category>Browse Category</button>\n")
    self.response.out.write("http://gdata.youtube.com/feeds/api/videos/-/<input type=text size=20 name=tag value=>\n")
    self.response.out.write("<select name=feed_type><option value=videos selected=selected>videos</option><option value=standard_feeds>standard_feeds</option><users value=users</select>")
    self.response.out.write("</form>\n")
    self.response.out.write("</table>\n")
    self.response.out.write(PAGE_FOOTER_DESKTOP)

########################################################################################
#programChannel programs a URLeScope channel based on selected channel and feed criteria
########################################################################################
class urleprogram(webapp.RequestHandler):
  def get(self):
    sid          = self.request.get('sid')
    local        = int(self.request.get('local'))
    feedtype     = self.request.get('feedtype')
    feedcategory = self.request.get('feedcategory')
    name         = self.request.get('name')
    description  = self.request.get('description')
    channel      = memcache.get(sid)
    scope        = db.get(db.Key(sid))
    if channel == "0":
      scope.uv0seq = 0
      scope.uv0name = name
      scope.uv0desc = description
      scope.uv0     = []
      scope.uv0info = []
    elif channel == "1":
      scope.uv1seq = 0
      scope.uv1name = localname[local] + " <i>" + feedcategory + "</i>"
      scope.uv1desc = "The " + feedcategory + " YouTube videos in " + localname[local]
      scope.uv1     = []
      scope.uv1info = []
    elif channel == "2":
      scope.uv2seq = 0
      scope.uv2name = localname[local] + " <i>" + feedcategory + "</i>"
      scope.uv2desc = "The " + feedcategory + " YouTube videos in " + localname[local]
      scope.uv2     = []
      scope.uv2info = []
    elif channel == "3":
      scope.uv3seq = 0
      scope.uv3name = localname[local] + " <i>" + feedcategory + "</i>"
      scope.uv3desc = "The " + feedcategory + " YouTube videos in " + localname[local]
      scope.uv3     = []
      scope.uv3info = []
    elif channel == "4":
      scope.uv4seq = 0
      scope.uv4name = localname[local] + " <i>" + feedcategory + "</i>"
      scope.uv4desc = "The " + feedcategory + " YouTube videos in " + localname[local]
      scope.uv4     = []
      scope.uv4info = []
    elif channel == "5":
      scope.uv5seq = 0
      scope.uv5name = localname[local] + " <i>" + feedcategory + "</i>"
      scope.uv5desc = "The " + feedcategory + " YouTube videos in " + localname[local]
      scope.uv5     = []
      scope.uv5info = []
    elif channel == "6":
      scope.uv6seq = 0
      scope.uv6name = localname[local] + " <i>" + feedcategory + "</i>"
      scope.uv6desc = "The " + feedcategory + " YouTube videos in " + localname[local]
      scope.uv6     = []
      scope.uv6info = []
    elif channel == "7":
      scope.uv7seq = 0
      scope.uv7name = localname[local] + " <i>" + feedcategory + "</i>"
      scope.uv7desc = "The " + feedcategory + " YouTube videos in " + localname[local]
      scope.uv7     = []
      scope.uv7info = []
    elif channel == "8":
      scope.uv8seq = 0
      scope.uv8name = localname[local] + " <i>" + feedcategory + "</i>"
      scope.uv8desc = "The " + feedcategory + " YouTube videos in " + localname[local]
      scope.uv8     = []
      scope.uv8info = []
    elif channel == "9":
      scope.uv9seq = 0
      scope.uv9name = localname[local] + " <i>" + feedcategory + "</i>"
      scope.uv9desc = "The " + feedcategory + " YouTube videos in " + localname[local]
      scope.uv9     = []
      scope.uv9info = []
    yt_service = gdata.youtube.service.YouTubeService()
    yt_service.email = 'toddurl@gmail.com'
    yt_service.password = 'bps2much'
    yt_service.source = 'URL IS/IT'
    yt_service.developer_key = 'AI39si4krlbAvnRe-8nfBf1xgkxqbG4fneeXsbNOr0XPqxA85NYyhcwy-t9xHKKyv1rxlM6QBffzrpdzZgKnslXJuzTtEFz60A'
    yt_service.client_id = 'toddurl'
    yt_service.ProgrammaticLogin()
    if feedtype == "standardfeeds":
      feed = "http://gdata.youtube.com/feeds/api/standardfeeds/" + localcode[local] + "/"
      if feedcategory == "top_rated":
        feed = feed + "top_rated"
    feed = yt_service.GetYouTubeVideoFeed(feed)
    for entry in feed.entry:
      urlevisionURL = str(entry.GetSwfUrl())
      if not urlevisionURL == "None":
        urlevisionURI = urlevisionURL.replace("http://www.youtube.com/v/", "")
        urlevisionID = urlevisionURI.replace("?f=standard&c=toddurl&d=Tfsm3rwIjTFoJr3aCT243WD9LlbsOl3qUImVMV6ramM&app=youtube_gdata", "")
        entry.media.title.text = entry.media.title.text.replace("'", "&#39")
        entry.media.title.text = entry.media.title.text.replace("(", "")
        entry.media.title.text = entry.media.title.text.replace(")", "")
        if channel == "0":
          scope.uv0.append(urlevisionID)
          try:
            entry.media.title.text = entry.media.title.text.encode('ascii', 'strict')
          except:
            scope.uv0info.append("Unknown")
          else:
            scope.uv0info.append(entry.media.title.text)
        elif channel == "1":
          scope.uv1.append(urlevisionID)
          try:
            entry.media.title.text = entry.media.title.text.encode('ascii', 'strict')
          except:
            scope.uv1info.append("Unknown")
          else:
            scope.uv1info.append(entry.media.title.text)
        elif channel == "2":
          scope.uv2.append(urlevisionID)
          try:
            entry.media.title.text = entry.media.title.text.encode('ascii', 'strict')
          except:
            scope.uv2info.append("Unknown")
          else:
            scope.uv2info.append(entry.media.title.text)
        elif channel == "3":
          scope.uv3.append(urlevisionID)
          try:
            entry.media.title.text = entry.media.title.text.encode('ascii', 'strict')
          except:
            scope.uv3info.append("Unknown")
          else:
            scope.uv3info.append(entry.media.title.text)
        elif channel == "4":
          scope.uv4.append(urlevisionID)
          try:
            entry.media.title.text = entry.media.title.text.encode('ascii', 'strict')
          except:
            scope.uv4info.append("Unknown")
          else:
            scope.uv4info.append(entry.media.title.text)
        elif channel == "5":
          scope.uv5.append(urlevisionID)
          try:
            entry.media.title.text = entry.media.title.text.encode('ascii', 'strict')
          except:
            scope.uv5info.append("Unknown")
          else:
            scope.uv5info.append(entry.media.title.text)
        elif channel == "6":
          scope.uv6.append(urlevisionID)
          try:
            entry.media.title.text = entry.media.title.text.encode('ascii', 'strict')
          except:
            scope.uv6info.append("Unknown")
          else:
            scope.uv6info.append(entry.media.title.text)
        elif channel == "7":
          scope.uv7.append(urlevisionID)
          try:
            entry.media.title.text = entry.media.title.text.encode('ascii', 'strict')
          except:
            scope.uv7info.append("Unknown")
          else:
            scope.uv7info.append(entry.media.title.text)
        elif channel == "8":
          scope.uv8.append(urlevisionID)
          try:
            entry.media.title.text = entry.media.title.text.encode('ascii', 'strict')
          except:
            scope.uv8info.append("Unknown")
          else:
            scope.uv8info.append(entry.media.title.text)
        elif channel == "9":
          scope.uv9.append(urlevisionID)
          try:
            entry.media.title.text = entry.media.title.text.encode('ascii', 'strict')
          except:
            scope.uv9info.append("Unknown")
          else:
            scope.uv9info.append(entry.media.title.text)
    scope.put()
    self.response.out.write("sid=%s, channel=%s, feedtype=%s, feedcategory=%s, local=%s" % (sid, channel, feedtype, feedcategory, local))

class footube_data_api_query_generator(webapp.RequestHandler):
  def post(self):
    self.response.out.write(PAGE_HEADER_DESKTOP)
    self.response.out.write(STYLE_SHEET_DESKTOP)
    self.response.out.write(MAIN_MENU_DESKTOP)
    self.response.out.write("<table width=684 border=0 cellpadding=0 cellspacing=0 summary=content><tr valign=top>\n")
    self.response.out.write("<tr>")
    self.response.out.write("<td class=\"grey2 greyj\" width=684>")
    self.response.out.write("<div class=mdig>")
    self.response.out.write("<font class=odd>YouTube Data API Query </font><font class=url>Results</font>")
    self.response.out.write("</tr>")
    self.response.out.write("<td valign=top class=grey1 width=684>")
    self.response.out.write("<div class=msmall0>")
    self.response.out.write("<font class=odd>Test </font><font class=url>Suite</font>")
    self.response.out.write("</tr>")
    self.response.out.write("<td valign=top class=grey3 width=684>")
    self.response.out.write("<font class=orb>")
    feed_request = self.request.get('feed_request')
    feed_type = self.request.get('feed_type')
    if feed_request == "category":
      self.response.out.write("feed_request=%s<br />" % feed_request)
      self.response.out.write("feed_type=%s<br />" % feed_type)
      tag = self.request.get('tag')
      tag = tag.replace(' ','/')
      self.response.out.write("tag=%s<br />" % tag)
      yt_service = gdata.youtube.service.YouTubeService()
      yt_service.email = 'toddurl@gmail.com'
      yt_service.password = 'bps2much'
      yt_service.source = 'URL IS/IT'
      yt_service.developer_key = 'AI39si4krlbAvnRe-8nfBf1xgkxqbG4fneeXsbNOr0XPqxA85NYyhcwy-t9xHKKyv1rxlM6QBffzrpdzZgKnslXJuzTtEFz60A'
      yt_service.client_id = 'toddurl'
      yt_service.ProgrammaticLogin()
      self.response.out.write("URL=http://gdata.youtube.com/feeds/api/videos/-/%s<br />" % tag)
      self.response.out.write("</font>")
      feed = yt_service.GetYouTubeVideoFeed("http://gdata.youtube.com/feeds/api/videos/-/" + tag)
      for entry in feed.entry:
#       self.response.out.write("%s<br />" % str(entry.GetSwfUrl()))
        urlevisionURL = str(entry.GetSwfUrl())
        if not urlevisionURL == "None":
          urlevisionURI = urlevisionURL.replace("http://www.youtube.com/v/", "")
#         urlevisionID = urlevisionURI.replace("?f=standard&c=toddurl&d=Tfsm3rwIjTFoJr3aCT243WD9LlbsOl3qUImVMV6ramM&app=youtube_gdata", "")
          urlevisionID = urlevisionURI.replace("?f=videos&c=toddurl&d=Tfsm3rwIjTFoJr3aCT243WD9LlbsOl3qUImVMV6ramM&app=youtube_gdata", "")
          self.response.out.write("http://www.youtube.com/v/%s<br />" % urlevisionID)
#             urlevisionSEQ = urlevisionSEQ + urlevisionID + "\n"
#         memcache.set(str(local) + "." + str(i), urlevisionSEQ)
#         i = i+1
    self.response.out.write("</table>\n")
    self.response.out.write(PAGE_FOOTER_DESKTOP)

application = webapp.WSGIApplication([('/',                about),
                                      ('/home',            about),
                                      ('/About',           about),
                                      ('/Services',        services),
                                      ('/Experience',      experience),
                                      ('/Solutions',       solutions),
                                      ('/Support',         support),
                                      ('/Products',        products),
                                      ('/Staff',           staff),
                                      ('/Env',             env),
                                      ('/URLeProgram',     urleprogram),
                                      ('/URLeScope',       urlescope),
                                      ('/NEWRLeScope',     newrlescope),
                                      ('/URLeVision',      urlevision),
                                      ('/TestHarness',     testharness),
                                      ('/FooTube_Data_API_Query_Generator', footube_data_api_query_generator),
                                      ('/Contact_Response', contact_response),
                                      ('/Contact', contact)],
                                        debug=True)

def main():
    run_wsgi_app(application)

if __name__ == "__main__":
    main()
